我正在使用 Mac 并尝试安装用于加载图像的图像包(例如:How do I read an image file using Python?)。
我正在使用 anaconda 和 PyCharm。 python版本为2.7.10。
如果我尝试:pip install Image,它会显示:
Requirement already satisfied (use --upgrade to upgrade): Image in ./lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): pillow in ./lib/python2.7/site-packages (from Image)
Requirement already satisfied (use --upgrade to upgrade): django in ./lib/python2.7/site-packages (from Image)
但是当我加载它时,它说“没有名为 Image 的模块”。
我也尝试从 PyCharm 安装,但我无法从包搜索中找到 Image(我可以找到“image”,但似乎是不同的)。
请您参考如下方法:
您需要安装 Python 图像库 (PIL)。鉴于您正在使用 conda:
$ conda install pil
然后,从 python:
from PIL import Image
