报错:ModuleNotFoundError: No module named 'PIL'解决方法
运行时报错:
Traceback (most recent call last):
File "***.py", line 5, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
1
2
3
4
运行安装pillow命令:
pip install pillow
如果运行时显示
Requirement already satisfied: pillow in /anaconda3/lib/python3.7/site-packages (5.4.1)
1
表示已经安装过了,这时可以先卸载,获取最新的pillow
运行卸载命令: pip uninstall pillow
然后再次运行安装命令
pip install pillow
easy_install Pillow
python3 -m pip install pillow
1
pip install -i https://pypi.douban.com/simple pillow
安装完毕,需要检查一下安装是否成功。
打开python后,输入 from PIL import Image
Traceback (most recent call last):
File "***.py", line 5, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
1
2
3
4
运行安装pillow命令:
pip install pillow
如果运行时显示
Requirement already satisfied: pillow in /anaconda3/lib/python3.7/site-packages (5.4.1)
1
表示已经安装过了,这时可以先卸载,获取最新的pillow
运行卸载命令: pip uninstall pillow
然后再次运行安装命令
pip install pillow
easy_install Pillow
python3 -m pip install pillow
1
pip install -i https://pypi.douban.com/simple pillow
安装完毕,需要检查一下安装是否成功。
打开python后,输入 from PIL import Image
评论