未加载PIL库:/opt/local/lib/libjpeg.9.dylib

Shi*_*dla 3 python django homebrew python-imaging-library pillow

我有一个完美运行的网站设计在django,但不小心我卸载自制软件,因此所有包postgres,枕头等,已经丢失,因此再次安装所有这些,但当我运行django runserver我得到以下错误

Unhandled exception in thread started by <function wrapper at 0x1071c11b8>
Traceback (most recent call last):
  File "/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
    fn(*args, **kwargs)
  File "/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 101, in inner_run
    self.validate(display_num_errors=True)
  File "/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
    num_errors = get_validation_errors(s, app)
  File "/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
    self._populate()
  File "/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in _populate
    self.load_app(app_name)
  File "/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
    models = import_module('%s.models' % app_name)
  File "/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Users/shivakrishna/shiva/app/post-web-1.6/modes/directory/models.py", line 24, in <module>
    from PIL import Image, ImageDraw, ImageFont
  File "/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/PIL/Image.py", line 67, in <module>
    from PIL import _imaging as core
ImportError: dlopen(/Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/PIL/_imaging.so, 2): Library not loaded: /opt/local/lib/libjpeg.9.dylib
  Referenced from: /Users/shivakrishna/.virtualenvs/project/lib/python2.7/site-packages/PIL/_imaging.so
  Reason: image not found
Run Code Online (Sandbox Code Playgroud)

我尝试了与它相关的stackoverflow帖子上提供的所有内容

brew uninstall libjpeg
brew install libjpeg
Run Code Online (Sandbox Code Playgroud)

但他们都没有工作,而我的 brew list

boost       gdal        gmp     liblwgeom   libxml2     mysql       postgis     sfcgal
cgal        geoip       jpeg        libpng      little-cms2 openssl     postgresql  sqlite
freetype    geos        json-c      libspatialite   lzlib       pcre        proj        webp
freexl      giflib      libgeotiff  libtiff     mpfr        pillow      readline
Run Code Online (Sandbox Code Playgroud)

那么为什么它无法加载/opt/local/lib/libjpeg.9.dylib库?以及如何解决它?

Shi*_*dla 8

对于这种特殊问题,以下内容对我有用

pip install --upgrade pillow
Run Code Online (Sandbox Code Playgroud)