我正在尝试将pillow安装在运行macOS Sierra的Mac上,我使用pip命令来安装它
arunmani$ sudo pip install pillow
但是当我尝试在python中导入它时,我遇到了:
Aruns-MacBook-Air:~ arunmani$ python
Python 2.7.14 |Anaconda, Inc.| (default, Dec 7 2017, 11:07:58)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pillow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pillow
>>> exit()
我尝试使用PIL或import from PIL方法,正如另一篇tack overflow文章here所建议的那样。但是无济于事,我仍然不能把pillow导入到python中,有谁知道发生了什么吗?
发布于 2018-02-28 13:31:48
Its import pillow
try import PIL
发布于 2018-02-28 13:32:10
如果你同时安装了PIL
和Pillow
,那么你需要卸载其中的一个。因为它们不能在同一环境中共存。参考资料可以在here上找到。
发布于 2018-02-28 13:32:10
您在安装过程中使用的sudo将以root用户身份进行安装。然而,当你启动python时,它是在激活了虚拟环境的Anaconda中作为用户'arumani‘启动的。
您应该使用conda命令进行安装。
https://stackoverflow.com/questions/49022511
复制相似问题