尝试安装Python PIL模块失败,并显示“非零退出代码”

时间:2018-07-27 19:56:34

标签: python pycharm

我真的不明白为什么Python如此难以启动和正常运行。

无论如何,我刚刚重新安装了Python 3.7和PyCharm。我想在项目中使用Python Imaging Library,但是当我尝试使用PyCharm安装它时,出现以下错误:

pip install PIL
Non-zero exit code (1)
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:\Users\Jake\AppData\Local\Programs\Python\Python37-32\python.exe'.

Command output:
Collecting PIL

  Could not find a version that satisfies the requirement PIL (from versions: )
No matching distribution found for PIL
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

我尝试从CMD提示符下运行python -m pip install --upgrade pip,但随后出现此错误:

Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

我只是尝试使用与安装PIL和Numpy完全相同的方法来安装NumPy,没有任何问题。这使我认为Python 3.7可能不支持PIL?

有人可以向我解释这里的问题是什么,并帮助我将模块导入PyCharm项目吗?

1 个答案:

答案 0 :(得分:0)

不再维护PIL。您可以改用Pillow,这是更活跃的PIL分支。

pip install Pillow