我有这个先决条件:
- CentOS 6.5
- Python2.7 安装命令
./configure
--prefix=/usr/local --enable-unicode=ucs4;制作;进行安装;
- httpd 作为 Django 网站的网络服务器
我得到这样的回溯:
...
File "/var/www/html/mysite.com/mylib/uploader/fields.py", line 8, in <module>
from PIL import Image
File "/var/www/html/mysite.com/eggs/Pillow-2.4.0-py2.7-linux-x86_64.egg/PIL/Image.py", line 53, in <module>
File "/var/www/html/mysite.com/eggs/Pillow-2.4.0-py2.7-linux-x86_64.egg/PIL/_imaging.py", line 7, in <module>
File "/var/www/html/mysite.com/eggs/Pillow-2.4.0-py2.7-linux-x86_64.egg/PIL/_imaging.py", line 6, in __bootstrap__
ImportError: /tmp/python-eggs/Pillow-2.4.0-py2.7-linux-x86_64.egg-tmp/PIL/_imaging.so: undefined symbol: PyCapsule_New
当我尝试从 Django shell 执行 from PIL import Image
时 - 它顺利通过了。
谷歌搜索这个错误对我帮助不大,请帮忙。
更新:
我尝试使用 Djangos 内部服务器(manage.py runserver
命令)为该网站提供服务,它工作正常。
我有一个类似的错误。
发生的事情是我的 python2.7 安装正在从系统 python2.6 中获取包(通过一些 PYTHONPATH muckery)
要进行调试,请在导入的内容之前放置一个断点,然后:
import sys
for path in sys.path:
print(path)
理想情况下它应该只包含 python2.7 的东西,但你可能已经将 python2.6 的东西泄露到它上面(或者相反)
我是一名优秀的程序员,十分优秀!