Python version 2.7 required, which was not found in the registry
作者:junjie 时间:2021-06-02 14:57:13
安装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,version,2.7,required
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
使用php数据缓存技术提高执行效率
2023-05-24 23:14:24
如何防止页面中的敏感信息被提取
2008-05-04 11:59:00
django manage.py扩展自定义命令方法
2023-11-03 20:55:42
![](https://img.aspxhome.com/file/2023/5/64225_0s.jpg)
批量获取及验证HTTP代理的Python脚本
2023-11-19 12:10:34
用蜜罐来阻止垃圾评论
2007-11-06 12:35:00
![](https://img.aspxhome.com/file/UploadPic/200711/6/200711612588568s.gif)
详解python编译器和解释器的区别
2023-06-26 03:53:09
巧用特殊的空格字符
2009-04-10 18:32:00
PHP-FPM运行状态的实时查看及监控详解
2023-11-22 22:45:22
![](https://img.aspxhome.com/file/2023/7/108587_0s.png)
新年伊始,看各大网站新春LOGO
2009-01-01 19:35:00
![](https://img.aspxhome.com/file/UploadPic/20091/1/114040f01010p00001031-53s.gif)
松子学ASP—Server篇
2008-04-22 14:14:00
ASP 相关文章或者相关产品
2011-03-30 11:12:00
一些常用的Python爬虫技巧汇总
2021-01-02 22:51:56
请给PNG8一个机会
2009-09-16 14:22:00
button标签的type属性默认值是?
2010-08-16 12:33:00
PHP取余函数介绍MOD(x,y)与x%y
2023-10-02 20:15:55
2010怎么就宅了——我们是设计星球的阿凡达
2010-03-09 13:26:00
![](https://img.aspxhome.com/file/UploadPic/20103/9/1003-2010zai-01-16s.jpg)
MYSQL各字段的长度是多少?
2009-10-28 18:32:00
Ext2.0.2经典的一个JS组件(带EXT中文手册)
2009-04-13 12:24:00
python爬取亚马逊书籍信息代码分享
2021-03-25 09:38:14
鼠标经过超链时的提示图层源码
2010-03-17 20:51:00