gpt4 book ai didi

Django Pillow/PIL 错误

转载 作者:行者123 更新时间:2023-12-01 16:42:59 25 4
gpt4 key购买 nike

我正在尝试使用 Django 教程制作 Tango,该教程使用 django 1.5。我正在使用 virtualenvwrapper。我用 pip 安装了 Pillow。

$ pip freeze
Django==1.5.5
Pillow==2.4.0
South==0.8.4
wsgiref==0.1.2.

(tangowithdjango)~/dev_django_projects/tangowithdjango$ which python
/Users/7stud/.virtualenvs/tangowithdjango/bin/python
(tangowithdjango)~/dev_django_projects/tangowithdjango$ python --version
Python 2.7.6

但是,在第 8 章中我收到以下错误:

(tangowithdjango)~/dev_django_projects/tangowithdjango$ ./manage.py syncdb 

CommandError: One or more models did not validate: rango.userprofile: "picture": To use ImageFields, you need to install the Python Imaging Library...

我无法安装 PIL,这就是我安装 Pillow 的原因:

(tangowithdjango)~/dev_django_projects/tangowithdjango$ pip install PIL
Downloading/unpacking PIL
Could not find any downloads that satisfy the requirement PIL
Some externally hosted files were ignored (use --allow-external PIL to allow).
Cleaning up...
No distributions at all found for PIL
Storing debug log for failure in /Users/7stud/.pip/pip.log

当我尝试时:

$ pip install Pillow-PIL 

它应该将有缺陷的导入语句转换为良好的导入语句,但我收到错误:

Could not find a version that satisfies the requirement Pillow-PIL (from versions: 0.1dev)

最后,如果我尝试在 shell 中使用 PIL:

(tangowithdjango)~/dev_django_projects/tangowithdjango$ ./manage.py shell
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from PIL import Image
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/7stud/.virtualenvs/tangowithdjango/lib/python2.7/site-packages/PIL/Image.py", line 53, in <module>
from PIL import _imaging as core
ImportError: dlopen(/Users/7stud/.virtualenvs/tangowithdjango/lib/python2.7/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
Referenced from: /Users/7stud/.virtualenvs/tangowithdjango/lib/python2.7/site-packages/PIL/_imaging.so
Expected in: flat namespace
in /Users/7stud/.virtualenvs/tangowithdjango/lib/python2.7/site-packages/PIL/_imaging.so
>>>

最佳答案

source

pip install PIL --allow-external PIL --allow-unverified PIL

关于Django Pillow/PIL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23437947/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com