简体   繁体   中英

Pillow will not import

I am using a plain install of python on windows I've installed the Pillow library with pip install Pillow and I am unable to import it whether I use import Image or from PIL import Image or import Pillow , all it returns is

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PIL'

When I try to intall Pillow again it returns the following which tells me it is already installed

Requirement already satisfied: Pillow in c:\users\isaac\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (6.2.1)

I have tried uninstalling and reinstalling Pillow via pip 19.3.1 and easy install.

Any help would be greatly appreciated.

What are you using? Pycharm, anaconda, or just plain install of python?

If you are using Pycharm or another progam that uses venv (virtual environments) then you must ensure you are downloading the library to the venv you are using for the project. This can be done through using pip inside the folder with the venv or by using pycharms built in import tool.

Plain install of python could be an issue on mac/linux machines. You maybe be using the machines built in system version of python and not using your install of it. If you are using mac/linux ensure you run files via python3 command as Im sure you are using modern python whereas macs current version i think is python2.7 and ubuntu uses 2.7 as well i believe. So if you were to run files via just python in command line you use the 2.7 version but if you use the python3 command you will use your fresh install of python!

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