[英]PIL (Pillow) not working for Python 3.8 on macOS
This is how I installed Pillow via the Terminal: pip install Pillow
这就是我通过终端安装 Pillow 的方式:
pip install Pillow
I am running Python 3.8.3 .我正在运行Python 3.8.3 。 When I tried to
import PIL
this showed up: ModuleNotFoundError: No module named 'PIL'
当我尝试
import PIL
时,出现了: ModuleNotFoundError: No module named 'PIL'
First: you should check if you python3.8.3 is the default.首先:你应该检查你的python3.8.3是否是默认的。
Eg what happens when you run python3 --version
例如,当你运行
python3 --version
时会发生什么
When that show the correct python version I would create a virtual env (aka "venv") first: this ensures that you don't pollute your new python with global packages.当显示正确的 python 版本时,我将首先创建一个虚拟环境(又名“venv”):这可确保您不会用全局包污染您的新 python。
python3 -m venv my_venv
Then activate the venv:然后激活venv:
source my_venv/bin/activate
Now you are ready to PIP install the dep:现在您已准备好 PIP 安装 dep:
pip3 install Pillow
pip install Pillow==2.2.1
Use above command to install Pillow and import by bellow statement使用上述命令安装 Pillow 并通过以下语句导入
from PIL import Image
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.