2014-01-05 67 views
0

PIL當我試圖在我的Ubuntu-12 *(它通過VirtualBox的仿真)我得到的消息,運行一些.py文件:故障在Ubuntu

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 
[email protected]:/$ 

的另一個問題是,我沒有使用Linux(我硬是被迫開始前做一個月的夫妻),所以我不知道如何處理這種情況。我真的需要幫助。 P.S.如果它很重要 - 在我嘗試運行.py文件之前,我已經安裝了pygame(成功)。

回答

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 

或者,最好是在虛擬環境中安裝,

+0

克里斯,你的解決方案的工作。非常感謝!驚人的容易 - 我花了2(2!)分鐘,以獲得所需的結果。 :) – srgg6701