[英]Python ImportError on Windows8.1 with module
I believe I have this problem because python is not finding the module installed on my machine and I'm not sure what the best way to debug this is. 我相信我有这个问题,因为python找不到我机器上安装的模块,我不确定调试它的最佳方法是什么。
First off, I know I have the module installed. 首先,我知道我已经安装了模块。 If I do
pip freeze
如果我
pip freeze
I get: 我得到:
Pillow==2.9.0
praw==2.1.20
requests==2.5.3
six==1.9.0
update-checker==0.11
However, when I try to run the following code, it tell me that there is no module named Pillow 但是,当我尝试运行以下代码时,它告诉我没有名为Pillow的模块
import os
from Pillow import Image
def extractFrames(inGif, outFolder):
frame = Image.open(inGif)
nframes = 0
while frame:
frame.save( '%s/%s-%s.gif' % (outFolder, os.path.basename(inGif), nframes ) , 'GIF')
nframes += 1
try:
frame.seek( nframes )
except EOFError:
break;
return True
extractFrames('donkey.gif', 'output')
I've programmed a lot in node.js so I'm used to package dependency there, but the system of pip is pretty foreign to and I would greatly appreciate any help. 我已经在node.js中进行了很多编程,因此我习惯了在其中打包依赖项,但是pip系统对它来说是很陌生的,我将不胜感激任何帮助。 Thanks!
谢谢!
It's 它的
from PIL import Image
Pillow is a fork of PIL and for backwards compatibility they kept the import name PIL. Pillow是PIL的分支,为了向后兼容,他们保留了导入名称PIL。 (Kind of weird).
(有点奇怪)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.