How to install pil python

How do I install PIL/Pillow for Python 3.6?

I have a script that requires PIL to run. Other than downgrading my Python, I couldn’t find anyway to install PIL on my Python 3.6 Here are my attempts:

pip install pil Collecting pil Could not find a version that satisfies the requirement pil (from versions: ) No matching distribution found for pil pip install Pillow Collecting Pillow Using cached Pillow-3.3.1.zip Installing collected packages: Pillow Running setup.py install for Pillow . error Complete output from command c:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ABDULR~1\\AppData\\Local\\Temp\\pip-build-rez5zpri\\Pillow\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ABDULR~1\AppData\Local\Temp\pip-a5bugnjo-record\install-record.txt --single-version-externally-managed --compile: Single threaded build for windows running install running build running build_py creating build creating build\lib.win-amd64-3.6 creating build\lib.win-amd64-3.6\PIL copying PIL\. . . running egg_info writing Pillow.egg-info\PKG-INFO writing dependency_links to Pillow.egg-info\dependency_links.txt writing top-level names to Pillow.egg-info\top_level.txt warning: manifest_maker: standard file '-c' not found reading manifest file 'Pillow.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching '*.sh' no previously-included directories found matching 'docs\_static' warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.editorconfig' warning: no previously-included files found matching '.landscape.yaml' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'build_children.sh' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files matching '.git*' found anywhere in distribution warning: no previously-included files matching '*.pyc' found anywhere in distribution warning: no previously-included files matching '*.so' found anywhere in distribution writing manifest file 'Pillow.egg-info\SOURCES.txt' copying PIL\OleFileIO-README.md -> build\lib.win-amd64-3.6\PIL running build_ext Traceback (most recent call last): File "", line 1, in File "C:\Users\ABDULR~1\AppData\Local\Temp\pip-build-rez5zpri\Pillow\setup.py", line 753, in zip_safe=not debug_build(), ) File "c:\python\python36\lib\distutils\core.py", line 148, in setup dist.run_commands() File "c:\python\python36\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "c:\python\python36\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "c:\python\python36\lib\site-packages\setuptools\command\install.py", line 61, in run return orig.install.run(self) File "c:\python\python36\lib\distutils\command\install.py", line 539, in run self.run_command('build') File "c:\python\python36\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\python\python36\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "c:\python\python36\lib\distutils\command\build.py", line 135, in run self.run_command(cmd_name) File "c:\python\python36\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\python\python36\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "c:\python\python36\lib\distutils\command\build_ext.py", line 338, in run self.build_extensions() File "C:\Users\ABDULR~1\AppData\Local\Temp\pip-build-rez5zpri\Pillow\setup.py", line 521, in build_extensions ' using --disable-%s, aborting' % (f, f)) ValueError: zlib is required unless explicitly disabled using --disable-zlib, aborting ---------------------------------------- Command "c:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ABDULR~1\\AppData\\Local\\Temp\\pip-build-rez5zpri\\Pillow\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ABDULR~1\AppData\Local\Temp\pip-a5bugnjo-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ABDULR~1\AppData\Local\Temp\pip-build-rez5zpri\Pillow\ 

Didn’t know to add argument —disable-zlib , pip install Pillow —disable-zlib wasn’t correct. Couldn’t find what matches my system here: https://pypi.python.org/pypi/Pillow/3.0.0 64-bit Windows 10 & Python 3.6

Читайте также:  Php доступ к базе данных

Источник

how to install PIL with pip?

Use Pillow which is the «new» or the replacement of PIL, but has the same-named modules to preserve compatibility:

Also, as suggested in the comments, maybe you are just using the wrong python binary, try to check if you’re in/out of a virtual environment or check differences between python vs python3 vs python2 on your system:

python -m pip list python2 -m pip list python3 -m pip list 

If you are sure that you already installed pillow use this command pip install pillow —upgrade , then you can use the command pip freeze to list all modules that have been installed.

The problem is that you are not running the same python interpreter. In addition, the problem could arise from this fact that python cannot find the path to the OpenCV.

You first need to find the path to the OpenCV installed on your OS.

First, open a python script and run this:

import cv2 PATH = cv2.__file__ print(PATH) 

This will print the PATH to the OpenCV installed on your OS.

Then, add the following two lines to the top of your main script (before calling tkinter and PIL):

import sys sys.path.append('PATH') from tkinter import * from PIL import ImageTk, Image root.mainloop() 

Alternative Solution:

The problem could be that you are not running the same python interpreter.

You first need to find the path to the python executable that is interpreting your python scripts.

Open a python script and run this:

import sys PATH = sys.executable print(PATH) 

This will print the path to the python executable that is interpreting your python scripts.

Читайте также:  Wordpress php get current url

Now, you can install pillow in the found path as follows:

PATH -m pip install pillow 

Источник

Оцените статью