Python version 2.7 required, which was not found in the registry


Posted in Python onAugust 26, 2014

安装PIL库的时候,直接提示:Python version 2.7 required, which was not found in the registry。
如图:

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文件目录下执行:

Python version 2.7 required, which was not found in the registry

重新安装PIL,错误解决,安装成功。

如果是win7 64位的用户在安装Python 32位程序时,如果选择只为当前用户,以上问题不会出现。如果选择所有用户,就试着使用以上方法解决。

提示其它版本解决方法类似。

Python 相关文章推荐
Python中Collection的使用小技巧
Aug 18 Python
Python matplotlib绘图可视化知识点整理(小结)
Mar 16 Python
python 按照固定长度分割字符串的方法小结
Apr 30 Python
Python实现的逻辑回归算法示例【附测试csv文件下载】
Dec 28 Python
.dcm格式文件软件读取及python处理详解
Jan 16 Python
Python @property装饰器原理解析
Jan 22 Python
使用python检查yaml配置文件是否符合要求
Apr 09 Python
Python基于BeautifulSoup爬取京东商品信息
Jun 01 Python
Win10下配置tensorflow-gpu的详细教程(无VS2015/2017)
Jul 14 Python
使用pygame实现垃圾分类小游戏功能(已获校级二等奖)
Jul 23 Python
一文详述 Python 中的 property 语法
Sep 01 Python
Pandas实现DataFrame的简单运算、统计与排序
Mar 31 Python
web.py中调用文件夹内模板的方法
Aug 26 #Python
web.py在模板中输出美元符号的方法
Aug 26 #Python
Django1.3添加app提示模块不存在的解决方法
Aug 26 #Python
Python引用(import)文件夹下的py文件的方法
Aug 26 #Python
Python中使用item()方法遍历字典的例子
Aug 26 #Python
Python过滤函数filter()使用自定义函数过滤序列实例
Aug 26 #Python
Python3.0与2.X版本的区别实例分析
Aug 25 #Python
You might like
一些PHP Coding Tips(php小技巧)[2011/04/02最后更新]
2011/05/02 PHP
详解WordPress中给链接添加查询字符串的方法
2015/12/18 PHP
php + nginx项目中的权限详解
2017/05/23 PHP
详解thinkphp5+swoole实现异步邮件群发(SMTP方式)
2017/10/13 PHP
phpstudy2018升级MySQL5.5为5.7教程(图文)
2018/10/24 PHP
利用js的Node遍历找到repeater的一个字段实例介绍
2013/04/25 Javascript
JQUERY 获取IFrame中对象及获取其父窗口中对象示例
2013/08/19 Javascript
js分页代码分享
2014/04/28 Javascript
利用jquery操作Radio方法小结
2014/10/20 Javascript
JS实现弹出居中的模式窗口示例
2016/06/20 Javascript
js中使用使用原型(prototype)定义方法的好处详解
2016/07/04 Javascript
js数字计算 误差问题的快速解决方法
2017/02/28 Javascript
深入理解vue.js中的v-if和v-show
2017/06/22 Javascript
JS实现电话号码的字母组合算法示例
2019/02/26 Javascript
简单介绍Python的Django框架的dj-scaffold项目
2015/05/30 Python
Python中使用ElementTree解析XML示例
2015/06/02 Python
用生成器来改写直接返回列表的函数方法
2017/05/25 Python
TensorFlow入门使用 tf.train.Saver()保存模型
2018/04/24 Python
python计算两个地址之间的距离方法
2018/06/09 Python
django中media媒体路径设置的步骤
2019/11/15 Python
Python全局变量与global关键字常见错误解决方案
2020/10/05 Python
用python获取txt文件中关键字的数量
2020/12/24 Python
使用canvas一步步实现图片打码功能的方法
2019/06/17 HTML / CSS
英国Amara家居法国网站:家居装饰,现代装饰和豪华礼品
2016/12/15 全球购物
纽约市的奢华内衣目的地:Anya Lust
2019/08/02 全球购物
国际贸易毕业生求职信范文
2014/02/21 职场文书
合作意向协议书范本
2014/03/31 职场文书
合作意向书格式及范文
2014/03/31 职场文书
目标责任书范文
2014/04/14 职场文书
公司员工辞职信范文
2015/05/12 职场文书
水浒传读书笔记
2015/06/25 职场文书
2015大学迎新晚会策划书
2015/07/16 职场文书
2016年综治和平安建设宣传月活动总结
2016/04/01 职场文书
MongoDB 常用的crud操作语句
2021/06/20 MongoDB
25张裸眼3D图片,带你重温童年的记忆,感受3D的魅力
2022/02/06 杂记
MySQL库表太大怎么办? 数据库分库分表项目实践
2022/04/11 MySQL