本文介绍了ImportError:没有名为枕头的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用枕头在Mac OS X Pro上,我做了以下操作:
I'm trying to work with pillow on a Mac OS X Pro, where I did the following:
from pillow import Image
但是,我得到了这个错误:
However, I got the this error:
ImportError: No module named pillow
当我尝试按以下方式安装枕头时:
When I try to install pillow as follow:
sudo pip install pillow
我得到以下信息:
Requirement already satisfied: pillow in /Library/Python/2.7/site-packages
Requirement already satisfied: olefile in /Library/Python/2.7/site-packages (from pillow)
我现在不知道该怎么办.我已经安装了枕头,但是无法导入它.
I'm not sure what to do at this point. I have pillow installed, but not able to import it.
有什么想法吗?
谢谢.
推荐答案
程序包名称称为pillow
,但Python Image Library
的用法如下:
The package name is called pillow
but Python Image Library
is used as follows:
from PIL import Image
#Read image
im = Image.open( 'image.jpg' )
#Display image
im.show()
PIL
是旧的软件包,已终止使用,但是Pillow
仍在开发中,这就是为什么安装时名称不同但导入仍然像旧的PIL
PIL
was the old package, which was discontinued, but Pillow
is still developed, that's why the name is different when installing but import's are still like the old PIL
这篇关于ImportError:没有名为枕头的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!