本文介绍了枕头已安装,但“没有名为枕头的模块"导入时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我安装了 Pillow
包:
python -m pip install pillow
收到成功消息(成功安装枕头
).关闭并重新打开终端.
Got success message (Successfully installed pillow
). Closed and re-opened the terminal.
但是当我尝试:
import pillow
我收到错误消息:
导入错误:没有名为枕头的模块
如果 python -m pip install Pillow
再次运行,它说
If python -m pip install pillow
is run again, it says
Requirement already satisfied (use --upgrade to upgrade): pillow in c:python27libsite-packages
推荐答案
尝试使用
import PIL
或
from PIL import ...
相反.Pillow
是 PIL
,Python 成像库,不再维护.但是,为了保持向后兼容性,使用了旧的模块名称.
instead. Pillow
is a fork of PIL
, the Python Imaging Library, which is no longer maintained. However, to maintain backwards compatibility, the old module name is used.
这篇关于枕头已安装,但“没有名为枕头的模块"导入时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!