Python version 2.7 required, which was not found in the registry,pythonrequired
Python version 2.7 required, which was not found in the registry,pythonrequired
安装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位程序时,如果选择只为当前用户,以上问题不会出现。如果选择所有用户,就试着使用以上方法解决。
提示其它版本解决方法类似。
你要先自己下载安装python2.7,
重新安装下python 在安装呗
看这个错误提示好像是没有找到python
相关内容
- 闭包在python中的应用之translate和maketrans用法详解,pyt
- python中的多线程实例教程,python实例教程
- Python对象的深拷贝和浅拷贝详解,python拷贝详解
- Python中声明只包含一个元素的元组数据方法,python声明
- Python跳出循环语句continue与break的区别,pythoncontinue
- Python实现的一个找零钱的小程序代码分享,python零钱
- Python中变量交换的例子,python变量交换
- Python中请使用isinstance()判断变量类型,pythonisinstance
- Python实现的一个自动售饮料程序代码分享,python程序代
- Python对小数进行除法运算的正确方法示例,python除法
评论关闭