第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

安裝python庫(kù)Pillow(PIL)出現(xiàn)問(wèn)題及解決方法

標(biāo)簽:
Java Python

安装PIL,问题多多,现将出现问题,原因,以及解决方法总结如下:
PIL的官方版本,但是最后一次维护是2009年,现以宣布停止维护,可以运行在python2.7上。
PillowPIL的fork版本,还在继续维护更新,建议安装Pillow

在安装Pillow之前,请卸载PIL

sudo pip uninstall PIL

安装Pillow 依赖,下面安装是真对ubuntu14.04版本


libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk```

下面介绍各包提供功能,以及需要的包版本限制(重要)

ibjpeg provides JPEG functionality.

  1. Pillow has been tested with libjpeg versions 6b, 8, 9, and 9a and libjpeg-turbo version 8.

  2. Starting with Pillow 3.0.0, libjpeg is required by default, but may be disabled with the--disable-jpeg
    flag.

zlib provides access to compressed PNGs

  1. Starting with Pillow 3.0.0, zlib is required by default, but may be disabled with the--disable-zlib
    flag.

libtiff provides compressed TIFF functionality

  1. Pillow has been tested with libtiff versions 3.x and 4.0

libfreetype provides type related services

littlecms provides color management

  1. Pillow version 2.2.1 and below uses liblcms1, Pillow 2.3.0 and above uses liblcms2. Tested with 1.19 and 2.7.

libwebp provides the WebP format.

  1. Pillow has been tested with version 0.1.3, which does not read transparent WebP files.

  2. Versions 0.3.0 and above support transparency.

tcl/tk provides support for tkinter bitmap and photo images.

openjpeg provides JPEG 2000 functionality.

  1. Pillow has been tested with openjpeg 2.0.0 and 2.1.0.

  2. Pillow does not support the earlier 1.5 series which ships with Ubuntu and Debian.

在我的ubuntu14.04openjpeg版本过低,所以找到openjpeg的官方网站编译安装最新版的openjpeg

  1. 下载 openjpeg

  2. cd DownloadPath  tar -xzvf Download file name

  3. cd Download file

  4. sudo cmake .

  5. sudo make

  6. sudo make install

完成依赖安装后,使用命令sudo pip install Pillow安装Pillow

https://img1.sycdn.imooc.com//5d58b87c0001c4a508530428.png

Pillow 安装提示


图片中的内容包括Pillow中的各个功能是否支持,如果这些功能出现unsupport ,那么就参考上面包提供功能,检测系统下依赖包是否满足Pillow的要求。
最后打开python解释器,输入from PIL import Image如果成功导入,说明 安装成功。


在我的ubuntu 14.04安装成功后,在导入仍然提示:[PIL - libopenjp2.so: cannot open shared object file: No such file or directory]这样的错误,在stackoverflow找到了解决方法:

  1. wheries libopenjp2 找到动态链接库的文件位置

  2. cd \etc ls -l |grep 'ld.so.conf'  找到ld.so.conf文件

  3. 编辑该文件,将libopenjp2库的路径,添加到ld.so.conf文件中

  4. sudo ldconfig
    下面是python找不到动态链接库的原因:以及设置 LD_LIBRARY_PATH有时不能良好解决问题的原因:

sys.path is only searched for Python modules. For dynamic linked libraries, the paths searched must be in LD_LIBRARY_PATH. Check if your LD_LIBRARY_PATH includes /usr/local/lib, and if it doesn't, add it and try again.In Linux, the environment variable LD_LIBRARY_PATH is a colon-separated set of directories where libraries should be searched for first, before the standard set of directories; this is useful when debugging a new library or using a nonstandard library for special purposes. The environment variable LD_PRELOAD lists shared libraries with functions that override the standard set, just as /etc/ld.so.preload does. These are implemented by the loader /lib/ld-linux.so. I should note that, while LD_LIBRARY_PATH works on many Unix-like systems, it doesn't work on all; for example, this functionality is available on HP-UX but as the environment variable SHLIB_PATH, and on AIX this functionality is through the variable LIBPATH (with the same syntax, a colon-separated list).



作者:jockerMe
链接:https://www.jianshu.com/p/c83e7a599eea


點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫(xiě)下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消