python - 枕头 : undefined symbol: PyCapsule_New

标签 python django apache centos

我有这个先决条件:

  • 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 的东西泄露到它上面(或者相反)

关于python - 枕头 : undefined symbol: PyCapsule_New,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22970108/

相关文章:

python - 如何测试 pygame 屏幕中的 2d 点是否是 PyOpenGL 中 3d 对象的一部分?

python - 如何在 Google Colaboratory 中导入和读取一个 shelve 或 Numpy 文件?

Apache Velocity $ 与 $!{}

java - 如何在 php 中为 windows 创建 localhost 域管理?

python - 如何在忽略前缀的情况下对数据框进行排序?

python - 使用命令行参数从另一个 Python 脚本打开 IDLE

json - JSONRenderer无法序列化:b'{“id”:“11122211133311”}}不可JSON序列化

python - 无法在 Visual Studio Virtual Env Python 3.5 64 位中使用 PIP 安装 mysqlclient

python - Django 代理用户模型示例

python - Web.py 无法使用 mod_wsgi 与 Apache 一起使用