安装第三方库出现 Python version 2.7 required, which was not found in the registry

原创 2013年12月05日 23:41:29
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!"
    
if __name__ == "__main__":

    RegisterPy()


如果在windows环境下安装python的第三方库时出现如上的错误,可以用以上的脚本编译解决

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

解决安装MySQL-python出现的:Python version 2.7 required, which was not found in the registry

安装MySQL-python-1.2.3.win-amd64-py2.7.exe,时提示:Python version 2.7 required, which was not found in the...

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

安装PIL-1.1.7.win32-py2.7的时候,不能再注册表中识别出来python2.7  方法:新建一个register.py 文件,把一下代码贴进去,保存 # # script ...

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

转自:http://www.cnblogs.com/min0208/archive/2012/05/24/2515584.html 安装setuptools的时候,不能再注册表中识别出来pyth...

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

安装setuptools的时候,不能再注册表中识别出来python2.7 在网上找了方法,仅作笔记,供下次使用: 下载和安装Python的第三方图像处理的库:PIL(Python Imaging L...

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

安装setuptools的时候,不能再注册表中识别出来python2.7 在网上找了方法,仅作笔记,供下次使用   方法:   新建一个register.py 文件,把一...

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

安装MySQL-python-1.2.5.win32-py2.7 (64位系统也可以安装)时,出现问题:python version 2.7 required,which was not found ...

Python Version 2.7 required which was not found in the registry

在使用“MySQLdb”操作MySQL数据库时,提示错误:ERR import MySQLdb ImportError: No module named MySQLdb,然后去下载安装包“MySQL-...

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

如题,很心塞啊,包的版本完全一致,但是在包的安装时却出现了这样的错误,哎,,还好后来完美解决了 我Python环境变量什么的都配置好了,版本都是2.7,整了一个晚上都没好,后来把错误百度了一下,并附...

Python Version 2.7 required which was not found in the registry

Python Version 2.7 required which was not found in the registry 官网给出的方法 运行一个脚本 博友的方法 修改注册表项 最简单的方法 重...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)