本文介绍了Django - 没有名为PIL的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在我的模型中使用 ImageField
,而且似乎没有安装:
I need to use ImageField
in my models and PIL seems not to be installed:
>>> from PIL import Image
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named PIL
但是我可以看到python-imaging 安装在突触中。当我尝试轻松安装它,我得到:
However I can see python-imaging installed in Synaptic. When I try to easy-install it, I get:
$ sudo easy_install-2.7 PIL
[sudo] password for glide:
Searching for PIL
Reading http://pypi.python.org/simple/PIL/
Reading http://www.pythonware.com/products/pil
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
Best match: PIL 1.1.7
Downloading http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
Processing PIL-1.1.7.tar.gz
Running PIL-1.1.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-HvRSQr/PIL-1.1.7/egg-dist-tmp-nDJHmU
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
libImaging/Quant.c: In function ‘rehash_collide’:
libImaging/Quant.c:154: warning: cast to pointer from integer of different size
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version 1.1.7
platform linux2 2.7.1 (r271:86832, May 2 2011, 14:22:06)
[GCC 4.4.3]
--------------------------------------------------------------------
*** TKINTER support not available
*** JPEG support not available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
To check the build, run the selftest.py script.
zip_safe flag not set; analyzing archive contents...
Image: module references __file__
Adding PIL 1.1.7 to easy-install.pth file
Installing pilconvert.py script to /usr/local/bin
Installing pilprint.py script to /usr/local/bin
Installing pildriver.py script to /usr/local/bin
Installing pilfont.py script to /usr/local/bin
Installing pilfile.py script to /usr/local/bin
Installed /usr/local/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-x86_64.egg
Processing dependencies for PIL
Finished processing dependencies for PIL
这仍然是不可用我必须做其他事情才能使用 ImageField
字段类型。
And this is still not usable. Do I have to do something else to be able to use the ImageField
field type ?
推荐答案
答案:
这篇关于Django - 没有名为PIL的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!