Python version 2.7 required, which was not found in the registry
耐特菲姆,索尼数码相机排行榜,人才重要性
安装pil库的时候,直接提示:python version 2.7 required, which was not found in the registry。
如图:
大意是说找不到注册表,网上搜索解决方案。
新建一个register.py文件写入代码:
import sys
from _winreg import *
# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
regpath = "software\\python\\pythoncore\\%s\\" % (version)
installkey = "installpath"
pythonkey = "pythonpath"
pythonpath = "%s;%s\\lib\\;%s\\dlls\\" % (
installpath, installpath, installpath
)
def registerpy():
try:
reg = openkey(hkey_current_user, regpath)
except environmenterror as e:
try:
reg = createkey(hkey_current_user, regpath)
setvalue(reg, installkey, reg_sz, installpath)
setvalue(reg, pythonkey, reg_sz, pythonpath)
closekey(reg)
except:
print "*** unable to register!"
return
print "--- python", version, "is now registered!"
return
if (queryvalue(reg, installkey) == installpath and
queryvalue(reg, pythonkey) == pythonpath):
closekey(reg)
print "=== python", version, "is already registered!"
return
closekey(reg)
print "*** unable to register!"
print "*** you probably have another python installation!"
启动命令切到register.py文件目录下执行:
重新安装pil,错误解决,安装成功。
如果是win7 64位的用户在安装python 32位程序时,如果选择只为当前用户,以上问题不会出现。如果选择所有用户,就试着使用以上方法解决。
提示其它版本解决方法类似。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
python如何查看网页代码
用python查看网页代码的方法:1、使用“import”导入requests包import requests2、使用requests包的get()函数通过网页...
[阅读全文]
-
-
python如何保存文本文件
python保存文本文件的方法:使用python内置的open()类可以打开文本文件,向文件里面写入数据可以用write()函数,写完之后,使用close()函...
[阅读全文]
-
python如何编写win程序
python可以编写win程序。win程序的格式是exe,下面我们就来看一下使用python编写exe程序的方法。编写好python程序后py2exe模块即可将...
[阅读全文]
-
-
-
-
-
-
网友评论