2012-01-06 50 views
1

我通過執行build,build_ext -i和install來在Python 2.7上在我的CentOS 6.2上構建和安裝PIL。我必須更改庫路徑,以便提供所有支持。 當我運行selftest.py它說,一切正常,並給予所有支持(特別是JPEG)。CentOS下的PIL安裝自測不錯,但jpeg不能正常工作

當運行我的程序,它會打開一個JPEG,增加了一些,並保存它,我得到的錯誤:

File "/opt/python2.7.2/lib/python2.7/site-packages/PIL/Image.py", line 401, in _getencoder 
    raise IOError("encoder %s not available" % encoder_name) 
IOError: encoder jpeg not available 

我的程序適用於其他系統的精細和它當我改變它運行在CentOS的機器罰款去png。我用python2.7運行所有命令,並且我已經嘗試重新安裝PIL。

因此,在短期:安裝PIL面前的自檢中成功運行,但在安裝後它不工作了。

回答

2

我發現在ubuntu forums

1/ Call 'pip install -I pil --no-install' to download and unpack the PIL source into your 
build directory; 
2/ Get into your build directory and edit setup.py; 
3/ Find the line that says 'add_directory(library_dirs, "/usr/lib")' (line 214 here); 
4/ Add the line 'add_directory(library_dirs, "/usr/lib/i386-linux-gnu")' afterwards; 
5/ Call 'pip install -I pil --no-download' to finish the installation. 
解決方案