Linux Mint 14&;python-PIL-gives<;解码器jpeg不可用>;错误

Linux Mint 14&;python-PIL-gives<;解码器jpeg不可用>;错误,python,django,python-imaging-library,virtualenv,Python,Django,Python Imaging Library,Virtualenv,我正在Django 1.4.1上尝试使用PIL上传图像并调整其大小 我试过这个: 但一切都没有改变 我使用了virtualenv,当我执行pip安装-I PIL时,我得到了以下错误: running install_lib creating /usr/lib/python2.7/site-packages error: could not create '/usr/lib/python2.7/site-packages': Permission denied IOError at /adm

我正在Django 1.4.1上尝试使用PIL上传图像并调整其大小

我试过这个:

但一切都没有改变

我使用了
virtualenv
,当我执行
pip安装-I PIL
时,我得到了以下错误:

running install_lib

creating /usr/lib/python2.7/site-packages

error: could not create '/usr/lib/python2.7/site-packages': Permission denied
IOError at /admin/main/pagecategory/21/

decoder jpeg not available

Request Method:     POST
Request URL:    http://localhost:8000/admin/main/pagecategory/21/
Django Version:     1.4.1
Exception Type:     IOError
Exception Value:    

decoder jpeg not available

Exception Location:     /home/chris/.virtualenvs/holistic/lib/python2.7/site-packages/PIL/Image.py in _getdecoder, line 385
Python Executable:  /home/chris/.virtualenvs/holistic/bin/python
Python Version:     2.7.3
Python Path:    

['/home/chris/Dropbox/workspace/holistic',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
 '/home/chris/.virtualenvs/holistic/lib/python2.7',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/plat-linux2',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/lib-tk',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/site-packages',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/site-packages/PIL',
 '/usr/local/lib/python2.7/site-packages',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/local/lib/python2.7/dist-packages/PIL']

Server time:    Fri, 4 Jan 2013 12:35:58 +0200
因此,我必须
sudo pip安装-I PIL
,它可以工作并提供以下信息:

   PIL 1.1.7 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.1.7
    platform      linux2 2.7.3 (default, Sep 26 2012, 21:51:14)
                  [GCC 4.7.2]
    --------------------------------------------------------------------
    *** TKINTER support not available
    --- JPEG support 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.
    changing mode of build/scripts-2.7/pildriver.py from 644 to 755
    changing mode of build/scripts-2.7/pilprint.py from 644 to 755
    changing mode of build/scripts-2.7/pilfile.py from 644 to 755
    changing mode of build/scripts-2.7/pilconvert.py from 644 to 755
    changing mode of build/scripts-2.7/pilfont.py from 644 to 755

    changing mode of /usr/local/bin/pildriver.py to 755
    changing mode of /usr/local/bin/pilprint.py to 755
    changing mode of /usr/local/bin/pilfile.py to 755
    changing mode of /usr/local/bin/pilconvert.py to 755
    changing mode of /usr/local/bin/pilfont.py to 755
Successfully installed PIL
Cleaning up...
但是,当我尝试保存模型时,会出现以下错误:

running install_lib

creating /usr/lib/python2.7/site-packages

error: could not create '/usr/lib/python2.7/site-packages': Permission denied
IOError at /admin/main/pagecategory/21/

decoder jpeg not available

Request Method:     POST
Request URL:    http://localhost:8000/admin/main/pagecategory/21/
Django Version:     1.4.1
Exception Type:     IOError
Exception Value:    

decoder jpeg not available

Exception Location:     /home/chris/.virtualenvs/holistic/lib/python2.7/site-packages/PIL/Image.py in _getdecoder, line 385
Python Executable:  /home/chris/.virtualenvs/holistic/bin/python
Python Version:     2.7.3
Python Path:    

['/home/chris/Dropbox/workspace/holistic',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
 '/home/chris/.virtualenvs/holistic/lib/python2.7',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/plat-linux2',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/lib-tk',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/site-packages',
 '/home/chris/.virtualenvs/holistic/lib/python2.7/site-packages/PIL',
 '/usr/local/lib/python2.7/site-packages',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/local/lib/python2.7/dist-packages/PIL']

Server time:    Fri, 4 Jan 2013 12:35:58 +0200
我做错了什么

(注:完全相同的配置在我的远程托管linux服务器上运行良好)


编辑:我拍了另一个详细的输出,谢谢

您的
激活
/
工作
脚本可能有问题。尝试传递virtualenv的
pip
绝对路径,如:

$ /tmp/myenv/bin/pip install -I PIL
要检查您的virtualenv中是否安装了PIL,请执行以下操作:

$ /tmp/myenv/bin/python -c 'import PIL'
如果没有错误,说明安装正确


可能您的问题与此相同:

我认为您需要使用
-E
选项进行安装。我发现
pip
/usr/lib/python2.7/site packages
下运行时,尝试在
virtualenv
中进行安装很奇怪。它不应该安装在
/home/chris/.virtualenvs/obsolutional/lib/pyhon2.7/站点包中吗?您是否使用了正确的
pip
安装
PIL
?另请参阅。@Rohan这是我得到的:
pip安装-E整体PIL用法:pip安装[OPTIONS]包\u名称。。。没有这样的选项:-E
@Evert我总是使用相同的pip(在我执行了
workon
命令之后。所有东西都安装在我的虚拟环境中。到目前为止,PIL是唯一的问题)我对枕头(PIL插件)也有同样的问题。表示JPEG在配置时正常,但在尝试加载JPEG时失败。