博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
安装第三方库出现 Python version 2.7 required, which was not found in the registry
阅读量:6948 次
发布时间:2019-06-27

本文共 1219 字,大约阅读时间需要 4 分钟。

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

建立一个文件 register.py 内容如下. 

import sysfrom _winreg import *# tweak as necessary  version = sys.version[:3]installpath = sys.prefixregpath = "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()

然后执行该脚本.

转载地址:http://rrhnl.baihongyu.com/

你可能感兴趣的文章
智能哲学:在AI前沿上人类伦理学的挑战与应战
查看>>
简单5步隐藏Ubuntu13.04 Unity 启动器
查看>>
《Redis入门指南》一5.4 Node.js与Redis
查看>>
《精通Python网络爬虫:核心技术、框架与项目实战》——2.3 用户爬虫的那些事儿...
查看>>
《树莓派渗透测试实战》——导读
查看>>
《数据科学与大数据分析——数据的发现 分析 可视化与表示》一2.6 第5阶段:沟通结果...
查看>>
《OpenGL ES 2.0游戏开发(上卷):基础技术和典型案例》——6.4节点法向量和面法向量...
查看>>
Storm-源码分析- Storm中Zookeeper的使用
查看>>
《Android 应用案例开发大全(第3版)》——导读
查看>>
Redis开发与运维. 2.2 字符串
查看>>
中化集团牵手阿里云拥抱互联网+ 打造领先的化工行业B2B垂直电商
查看>>
《C++面向对象高效编程(第2版)》——4.7 对象相等的语义
查看>>
《贝叶斯思维:统计建模的Python学习法》一1.7 Monty Hall难题
查看>>
《Kafka官方文档》设计(一)
查看>>
Android之.so文件奇巧淫技
查看>>
判断ftp是否登录成功
查看>>
双研究员带你了解数据库技术现状,及阿里云为什么要推出HBase
查看>>
乱码的艺术
查看>>
倒计时2天!杭州云栖大会八大亮点不容错过
查看>>
大数据助力物流透明,不只为了你的快递
查看>>