python3:安装后Pillow模块后,运行报错MytoduleNotFoundError: No module named 'PIL'

解决方法
卸载:pip3 uninstall pillow
重新安装:python3 -m pip install pillow

问题现象
安装:pip3 install pillow
Defaulting to user installation because normal site-packages is not writeable
Collecting pillow
Downloading Pillow-8.1.0-cp38-cp38-macosx_10_10_x86_64.whl (2.2 MB)
|████████████████████████████████| 2.2 MB 7.6 kB/s
Installing collected packages: pillow
Successfully installed pillow-8.1.0

运行程序:python3 transfer16to32bit.py
Traceback (most recent call last):
File “*", line 1, in
from PIL import Image
ModuleNotFoundError: No module named 'PIL'

检查:pip3 install pillow
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pillow in /Users/zhunix/Library/Python/3.8/lib/python/site-packages (8.1.0)

产生原因
系统中装有多个python版本,使用pip3安装时,装到了其他python版本的site-packages下。

posted on 2021-03-01 13:16  zhunix  阅读(479)  评论(0编辑  收藏  举报

导航