1. 程式人生 > >python安裝pillow時出錯(ubuntu)

python安裝pillow時出錯(ubuntu)

python錯誤

在進行圖像處理時可能會用到的包:pillow
在安裝時可能會遇到的錯誤信息中包含setuptools等關鍵字,此時需要執行一下命令來安裝基本環境:

apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev python-dev

在執行此命令時可能會遇到找不到包的問題,是因為更換源的原因,我是將源更換為了阿裏的鏡像,雖然速度變快了,但是會遇到找不到安裝包的錯誤,此時的處理方法是將鏡像源換回原來的,執行以下命令:

mv /etc/apt/sources.list{,.bak}
vim /etc/apt/sources.list

在打開的編輯器中輸入以下網址:

deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse

然後保存退出並執行以下命令更新:

apt-get update

更新完成之後,再次執行命令:

apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev python-dev

最後執行命令安裝pillow即可:

pip install pillow

技術分享圖片

python安裝pillow時出錯(ubuntu)