python - Django 1.7 Pillow 和 PIL 都无法导入 : No module named Image

标签 python linux ubuntu python-3.x

我正在使用 Django 1.7 和 Python3.4 开发一个应用程序。我已经按照 http://pillow.readthedocs.org 的说明安装了 Pillow 。但每当我尝试从管理员上传图像时,我都会收到以下错误:

ImproperlyConfigured at /admin/content/slide/add/

Neither Pillow nor PIL could be imported: No module named Image

Request Method:     POST
Request URL:    http://www.soujanyam.com/admin/content/slide/add/
Django Version:     1.7.2
Exception Type:     ImproperlyConfigured
Exception Value:    

Neither Pillow nor PIL could be imported: No module named Image

Exception Location:     /usr/local/lib/python3.4/dist-packages/django/utils/image.py in _detect_image_library, line 108
Python Executable:  /usr/bin/python
Python Version:     2.7.6
Python Path:    

['/home/ubuntu/websites/sloppyjoe',
 '/usr/local/lib/python3.4/dist-packages',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages']

最佳答案

sudo apt-get install libapache2-mod-wsgi-py3

以上命令解决了我的问题

关于python - Django 1.7 Pillow 和 PIL 都无法导入 : No module named Image,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27858657/

相关文章:

Python - 如何将 "an OS-level handle to an open file"转换为文件对象?

python - 在 Django 中测试重写的 save 方法

mysql - ubuntu 中 Django mysql 错误

linux - Bash 中的导出路径

python - 不能在 ubuntu docker 容器中写 ñ, ä, ë, ü

python - 在 Python 中将 Logo 添加到猫图像

python - 格式错误的 CSV 文件和 Pandas read_csv by chunk

linux - facebook, twitter 使用哪个 linux 发行版

linux - 为什么我的 BPF_PROG_TYPE_CGROUP_SKB 程序不能在容器中运行?

python - 有没有办法直接将 python 输出发送到剪贴板?