我想做一些图像处理,但遇到了问题。导入枕头模块似乎不起作用。我在这里找到了一个简单的脚本来检查安装了哪些软件包,我找到了它,但导入它似乎不起作用。
这是我尝试运行的代码:
import pip
installed_packages = pip.get_installed_distributions()
installed_pillow_packages = [
"%s==%s" % (i.key, i.version)
for i in installed_packages
if "pil" in i.key.lower()
]
print(installed_pillow_packages)
import pillow
结果如下:
runfile('C:/Users/Augustas/.spyder2/temp.py', wdir=r'C:/Users/Augustas/.spyder2')
['pillow==2.6.1']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 601, in runfile
execfile(filename, namespace)
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 66, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/Augustas/.spyder2/temp.py", line 7, in <module>
import pillow
ImportError: No module named pillow
我使用 Spyder 和 Python 2.7.9 在 Windows 8.1 上运行它。