简体   繁体   English

使用pip安装枕头时出现错误

[英]Getting Error While Installing Pillow using pip

I am Getting this error when i am installing pillow using command. 使用命令安装枕头时出现此错误。

$pip install Pillow

and i am running this command in virtual environment 我在虚拟环境中运行此命令

  File "/usr/lib/python2.7/distutils/command/install_lib.py", line 111, in build
    self.run_command('build_ext')
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/distutils/command/build_ext.py", line 337, in run
    self.build_extensions()
  File "setup.py", line 515, in build_extensions
    % (f, f))
ValueError: --enable-jpeg requested but jpeg not found, aborting.

you need to install the zlib-devel package in Linux in order to resolve this particular issue. 您需要在Linux中安装zlib-devel软件包才能解决此特定问题。

dnf install zlib-devel

works for Fedora. 适用于Fedora。

The newly released Python 3.0.0 now requires libjpeg for .jpg (and zlib for .png) by default. 新发布的Python 3.0.0现在默认情况下需要.jpg的libjpeg(和.png的zlib)。

From the docs : 文档

  • Starting with Pillow 3.0.0, libjpeg is required by default, but may be disabled with the --disable-jpeg flag. 从Pillow 3.0.0开始,默认情况下需要libjpeg,但可以通过--disable-jpeg标志禁用。

See here for how to use build options , and elsewhere on that page for instructions how to install libraries for different platforms. 有关如何使用构建选项的信息 ,请参见此处;有关该页面的其他信息,请参见如何为不同平台安装库的说明。

For AWS (Red Hat) you need to run the following two commands to get Pillow to install. 对于AWS(Red Hat),您需要运行以下两个命令来安装Pillow。

sudo yum install libjpeg
sudo yum install zlib-devel

Also note that you have to uninstall PIL if you are using it in the same environment. 另请注意,如果您在同一环境中使用PIL,则必须将其卸载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM