python - 尝试安装 Python PIL 模块失败并出现“非零退出代码”
问题描述
我真的不明白为什么 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.
我尝试python -m pip install --upgrade pip
从 CMD 提示符运行,但随后出现此错误:
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 项目吗?
解决方案
PIL 不再维护。您可以改用 Pillow,它是 PIL 的一个更活跃的分支。
pip install Pillow
推荐阅读
- c# - 在 Azure 函数中加密服务总线连接字符串
- django - Django Rest FrameWork 中的“many = True”有什么作用?
- javascript - 如何在悬停覆盖图像中包含文本 - 仅限 HTML、CSS、JavaScript
- python - 当我在 Django 上启动服务器时,这个问题怎么办?
- dynamics-crm - crm 2016 按类型代码获取实体逻辑名称?
- excel - VBA 跳转到下一列
- javascript - RegExp 与 lastIndex 匹配导致无限循环
- dns - AWS Route53 上的 MXE 记录
- php - 从选择查询中排除变量
- ios - 如何在目标c中的tableview上方实现一个选择/取消选择所有按钮?