PIL在终端工作,但不通过空闲

2024-09-29 11:14:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用枕头。我已按照本网站上的安装说明进行操作: http://www.pythonforbeginners.com/gui/how-to-use-pillow

当我在终端窗口中输入以下内容时:

$ python
Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>> 

它没有给我任何错误,所以假设链接的网站是正确的,这意味着枕头是正确安装。 但是,当我尝试使用Python空闲的PIL库时,如下所示:

^{pr2}$

Python给出错误消息:

Traceback (most recent call last):
  File "/Sample_application.py",
line 3, in <module>
from PIL import Image
ImportError: No module named 'PIL'

我做错什么了?我用的是MacOSX10.9,小牛


Tags: tofromimageimportcomhttppil网站
1条回答
网友
1楼 · 发布于 2024-09-29 11:14:56

您的系统上至少安装了两个Python;默认系统提供了2.7和python3.4。在

您的pip命令与Python2.7绑定;您可以使用该版本运行IDLE版本:

/usr/bin/idle

或者,您可以使用以下工具在Python 3.4中安装Pillow:

^{pr2}$

相关问题 更多 >