Ubuntu上的PIL问题

时间:2014-01-05 18:28:58

标签: python linux ubuntu pygame python-imaging-library

当我尝试在我的Ubuntu-12 *上运行一些.py文件时(它是通过VirtualBox模拟的)我收到了消息:

raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available

在寻找答案之后,我在这里找到了解决这个问题的一些潜在方法:PIL /JPEG Library / Help!,特别是(我想的)这里:https://stackoverflow.com/a/12301138/1522479 ...说下面的地方:

On Ubuntu precise, PIL doesn't find the jpeg library files, even once they are installed. The easiest way to fix this is to make a symlink after you have installed the jpeg dev package. So, I needed an extra step:

for x64 OS

pip uninstall PIL
sudo apt-get install libjpeg8-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
pip install PIL

然而,当我尝试这个解决方案时,我没有得到理想的结果。 这里是日志的结尾(抱歉这么大的一块):

PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------    
version       1.1.7

platform      linux2 2.7.4 (default, Apr 19 2013, 18:28:01)

              [GCC 4.7.3]    
--------------------------------------------------------------------    
*** TKINTER support not available (Tcl/Tk 8.5 libraries needed)    
--- JPEG support available    
*** ZLIB (PNG/ZIP) support not 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.    
running build_scripts    
creating build/scripts-2.7    
copying and adjusting Scripts/pilfile.py -> build/scripts-2.7    
copying and adjusting Scripts/pildriver.py -> build/scripts-2.7    
copying and adjusting Scripts/pilconvert.py -> build/scripts-2.7    
copying Scripts/pilfont.py -> build/scripts-2.7    
copying and adjusting Scripts/pilprint.py -> build/scripts-2.7    
changing mode of build/scripts-2.7/pilfile.py from 664 to 775    
changing mode of build/scripts-2.7/pildriver.py from 664 to 775    
changing mode of build/scripts-2.7/pilconvert.py from 664 to 775    
changing mode of build/scripts-2.7/pilfont.py from 664 to 775    
changing mode of build/scripts-2.7/pilprint.py from 664 to 775    
running install_lib    
creating /usr/local/lib/python2.7/dist-packages/PIL



error: could not create '/usr/local/lib/python2.7/dist-packages/PIL': Permission denied


----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-nupic/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-p6ZHoT-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-nupic/PIL
Storing complete log in /home/nupic/.pip/pip.log 
nupic@nupic-vm:/$

另一个问题是我没有使用linux(我真的被迫在几个月前开始做它),所以我不知道如何管理这种情况。真的,我需要帮助。 附:如果重要 - 在我尝试运行.py文件之前,我已经安装了pygame(成功)。

2 个答案:

答案 0 :(得分:1)

error: could not create '/usr/local/lib/python2.7/dist-packages/PIL': Permission denied

表示您有权限问题,如果您确实要在系统范围内安装PIL,请使用:

sudo pip install PIL

您也可以安装到用户拥有的目录:

sudo pip install --install-option="--prefix=$PREFIX_PATH" PIL

或者,最好安装在virtualenv中,

答案 1 :(得分:0)

您可以尝试安装枕头而不是PIL的叉子。 我将它用于所有需要PIL的网站。

安装pip install pillow

请参阅https://github.com/python-imaging/Pillow