黄色网页视频 I 影音先锋日日狠狠久久 I 秋霞午夜毛片 I 秋霞一二三区 I 国产成人片无码视频 I 国产 精品 自在自线 I av免费观看网站 I 日本精品久久久久中文字幕5 I 91看视频 I 看全色黄大色黄女片18 I 精品不卡一区 I 亚洲最新精品 I 欧美 激情 在线 I 人妻少妇精品久久 I 国产99视频精品免费专区 I 欧美影院 I 欧美精品在欧美一区二区少妇 I av大片网站 I 国产精品黄色片 I 888久久 I 狠狠干最新 I 看看黄色一级片 I 黄色精品久久 I 三级av在线 I 69色综合 I 国产日韩欧美91 I 亚洲精品偷拍 I 激情小说亚洲图片 I 久久国产视频精品 I 国产综合精品一区二区三区 I 色婷婷国产 I 最新成人av在线 I 国产私拍精品 I 日韩成人影音 I 日日夜夜天天综合

安裝PIL的坑

系統 1967 0

今天在centos中使用pip安裝PIL死活不成功,報錯:

        Could not find a version that satisfies the requirement PIL (from versions: )

  Some externally hosted files were ignored as access to them may be unreliable (use --allow-external PIL to allow).

  No matching distribution found for PIL


    

但是使用pip search PIL查找,源中確實有該包:

      PIL                                  - Python Imaging Library


    

?

google之,得到如下辦法(http://stackoverflow.com/questions/21242107/pip-install-pil-dont-install-into-virtualenv):

      sudo pip install PIL --allow-external PIL --allow-unverified PIL


    

果然成功了。

?

但是程序運行時又報錯:

      font = ImageFont.truetype(os.path.join("fonts",font_type), font_size)
      
ImportError: The _imagingft C module is not installed

似乎是沒有安裝truetype擴展之類的。那就安裝吧(http://stackoverflow.com/questions/4011705/python-the-imagingft-c-module-is-not-installed):

      sudo yum install freetype-devel


    

?

然后卸載、重新安裝PIL

      sudo pip uninstall PIL

sudo pip install PIL --allow-external PIL --allow-unverified PIL


    

終于搞定了  

?

?

?

PS:之前還嘗試過從官網下載PIL源碼自己編譯安裝:

(參照:http://www.cnblogs.com/free--coder/archive/2012/09/12/2681361.html)

1.下載源碼并解壓:

      wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz

tar -xzvf Imaging-1.1.7.tar.gz 


    

2.編譯安裝(注意要root權限):

      python setup.py build

python setup.py install  


    

?

安裝倒是成功了,但是python腳本運行時報錯:

      /usr/lib64/python2.7/site-packages/PIL/Image.py:81: RuntimeWarning: The _imaging extension was built for another  version of Pillow or PIL

  warnings.warn(str(v), RuntimeWarning)

Traceback (most recent call last):

  File "captcha.py", line 3, in <module>

    import Image, ImageDraw, ImageFont, ImageFilter

  File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 65, in <module>

    raise ImportError("The _imaging extension was built for another "

ImportError: The _imaging extension was built for another  version of Pillow or PIL


    

似乎版本不對。。。。。

放棄了

安裝PIL的坑


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論