【发布时间】:2018-05-10 11:27:24
【问题描述】:
我确实发现很少有人问这个问题,但没有一个人完全符合我的情况,所以我自己在这里问。 我在运行最新的 MacOS High Sierra 的 Mac 上已经(相当有)两个版本的 Python(2.7 和 3.4.3)。据我了解,v2.7 是 MacOS 的默认安装。我安装了 3.4.3(来自从 python 站点下载的 .dmg 文件)。因此,现在,python 命令默认为 2.7,而 python3 指向终端中的 3.4.3。 在尝试学习时,我尝试了一个使用
的 python 脚本import PIL 和 from PIL import Image
但是在运行时,这给出了错误ImportError: No module named PIL。
在对谷歌进行研究后,我想出了安装 PIL 和 Pillow 使用
sudo pip install Pillow
它安装正确,但我仍然遇到同样的错误。
为了消除混乱,我决定从系统中删除 python 3.4.3。但即使在它被删除后,我仍然得到同样的错误。
甚至pip list 也显示Pillow 5.1.0 好吧。
所以现在,我只有 Python 2.7,并且错误仍然存在,而 Pillow 也在其中。
which python 将/opt/local/bin/python 作为路径。
以上任何一项是否敲响了警钟?有什么想法,这里还有什么遗漏的?
【问题讨论】: