编译了 libjpeg v8、PIL 1.1.7 和 _imaging 导入在系统 Python 上工作,但在 virtualenv 中喷出此错误:
libjpeg.so.8: cannot open shared object file: No such file or directory
这是在 virtualenv 中使用 python -v 解释器运行的错误
>>> import _imaging
dlopen("/home/ygamretuta/dev/py/django/lib/python2.6/site-packages/PIL/_imaging.so", 2);
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libjpeg.so.8: cannot open shared object file: No such file or directory
这是路径:
/home/ygamretuta/dev/py/django/lib/python2.6/site-packages/distribute-0.6.14-py2.6.egg
/home/ygamretuta/dev/py/django/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg
/home/ygamretuta/dev/py/django/lib/python2.6
/home/ygamretuta/dev/py/django/lib/python2.6/plat-linux2
/home/ygamretuta/dev/py/django/lib/python2.6/lib-tk
/home/ygamretuta/dev/py/django/lib/python2.6/lib-old
/home/ygamretuta/dev/py/django/lib/python2.6/lib-dynload
/usr/lib/python2.6
/usr/lib/python2.6/plat-linux2
/usr/lib/python2.6/lib-tk
/home/ygamretuta/dev/py/django/lib/python2.6/site-packages
/home/ygamretuta/dev/py/django/lib/python2.6/site-packages/PIL
我使用的是 Ubuntu 10.10,这是 uname-a 输出:
Linux ygam-desktop 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:40:58 UTC 2011 i686 GNU/Linux
我正在使用 Python 2.6
我已经遵循了以下指南:
http://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/
http://www.jooncode.com/2010/12/02/python-pil-jpeg-resync-restart-error-imaging-module-solve/
原文由 yretuta 发布,翻译遵循 CC BY-SA 4.0 许可协议
请在此处查看解释: Why can’t Python find shared objects that are in directorys in sys.path?
快速修复是将包含
libjpeg.so.8
的目录添加到你的/etc/ld.so.conf
文件,然后运行ldconfig