今天寫Python程序上傳圖片需要用到PIL庫,于是到http://www.pythonware.com/products/pil/#pil117下載了一個1.1.7版本的,我用的是CentOS64 并且自行升級后的Python版本安裝PIL庫
首先下載解壓:
代碼如下:
[root@lee ~]# wget http://www.pythonware.com/products/pil/#pil117
[root@lee ~]# tar -xf Imaging-1.1.7.tar.gz
然后準備安裝
代碼如下:
[root@lee ~]# cd Imaging-1.1.7
[root@lee Imaging-1.1.7]# python python setup.py build_ext -i
都沒問題,當測試安裝的時候卻老提示:*** The _imaging C module is not installed
代碼如下:
[root@lee Imaging-1.1.7]# python selftest.py
*** The _imaging C module is not installed
找了半天,也找不出是什么原因,后來終于在官網從一堆英文中找到了關鍵所在,解決方法,實際根據自己的python PIL路徑設置
代碼如下:
[root@lee Imaging-1.1.7]# echo '/usr/local/lib/python2.7/site-packages/PIL' >> /etc/ld.so.conf
[root@lee Imaging-1.1.7]# ldconfig
重新python selftest.py,一路安裝完成
新聞熱點
疑難解答