Python 在 ubuntu 14.04 上安装 Pillow 时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32942861/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 12:31:43  来源:igfitidea点击:

Error installing Pillow on ubuntu 14.04

pythonpipubuntu-14.04pillow

提问by Navid777

I'm trying to install Pillow on Ubuntu 14.04 using this command:

我正在尝试使用以下命令在 Ubuntu 14.04 上安装 Pillow:

pip install Pillow

but the installation fails with this error:

但安装失败并出现此错误:

ValueError: --enable-jpeg requested but jpeg not found, aborting.

采纳答案by Navid777

The problem was that the package libjpeg-devwas not installed. To solve the problem you should do this:

问题是libjpeg-dev没有安装包。要解决这个问题,你应该这样做:

sudo apt-get install libjpeg-dev

回答by NamPNQ

You need to follow this tutorial Install pillow doc.

您需要按照本教程安装枕头文档

If you had installed, just uninstall and reinstall again:

如果您已经安装,只需卸载并重新安装:

$ pip uninstall pillow
$ pip install pillow --no-cache-dir

回答by waweru

You have to install the missing dependencies and libraries that Pillow requires for it to work. Find the dependencies here

您必须安装 Pillow 运行所需的缺失依赖项和库。在此处查找依赖项

This are the current dependancies/libraries for Ubuntu 14.04 for Pilllow 3.0.0+. Install them by running the command below

这是 Ubuntu 14.04 for Pillow 3.0.0+ 的当前依赖项/库。通过运行以下命令安装它们

sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

回答by Mahendra Yadav

Make sure Python-development packages are installed, if not then install it using the following commands :

确保安装了 Python 开发包,如果没有,则使用以下命令安装它:

For Ubuntu

对于 Ubuntu

sudo apt-get install python3-dev python3-setuptools

For Fedora

对于 Fedora

sudo dnf install python-devel

After installing the development packages install the following :

安装开发包后,安装以下内容:

For Ubuntu

对于 Ubuntu

sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

For Fedora

对于 Fedora

sudo dnf install libtiff-devel libjpeg-devel libzip-devel freetype-devel \
lcms2-devel libwebp-devel tcl-devel tk-devel

回答by ygesher

There may be a problem where pip is relying on a cached version of the dependencies, and clearing the cache can sometimes solve the problem. Just type

可能存在pip依赖缓存版本的依赖的问题,清除缓存有时可以解决问题。只需输入

$ rm -rf ~/.cache/pip

Source: github issue

来源:github问题