简体   繁体   中英

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.

dnf install zlib-devel

works for Fedora.

The newly released Python 3.0.0 now requires libjpeg for .jpg (and zlib for .png) by default.

From the docs :

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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