未载入的PIL Library: /opt/local/lib/libjpeg.9.dylib。

时间:2021-08-21 00:22:26

I have a perfectly running website designed in django, but accidentally i uninstalled homebrew and hence all the packages postgres, Pillow etc., had been lost and hence installed all of them again, but when i run the django runserver i got the below error

我在django设计了一个完美运行的网站,但是我意外地卸载了homebrew,因此所有的软件包postgres、Pillow等都丢失了,因此重新安装了它们,但是当我运行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

I tried everything that was available on * posts related to it like

我尝试了所有与它相关的*帖子。

brew uninstall libjpeg
brew install libjpeg

But none of them worked, and my 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

So why it can't load /opt/local/lib/libjpeg.9.dylib library ? and how to fix it ?

所以为什么它不能加载/opt/local/lib/libjpeg.9。dylib图书馆吗?那么如何修复呢?

1 个解决方案

#1


6  

For this particular kind of issue the following worked for me

对于这一特殊的问题,以下为我工作。

pip install --upgrade pillow

#1


6  

For this particular kind of issue the following worked for me

对于这一特殊的问题,以下为我工作。

pip install --upgrade pillow