2017-02-18 70 views
2

我有一個完美運行的網站在Django設計,但不小心我卸載自制軟件,因此所有的包postgres,枕頭等已經丟失,因此,安裝了所有的人再次,但是當我運行runserver命令我得到了以下錯誤PIL圖書館沒有加載:/opt/local/lib/libjpeg.9.dylib

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 

我想這是可以對有關它像

brew uninstall libjpeg 
brew install libjpeg 

計算器帖子一切Django的,但他們沒有工作,和我的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 

那爲什麼不能加載/opt/local/lib/libjpeg.9.dylib庫?以及如何解決它?

回答

6

對於這種特殊問題的以下工作對我來說

pip install --upgrade pillow