安装第三方库出现 Python version 2.7 required, which was not found in the registry
2015-08-21 23:03
911 查看
装第三方库出现 Python version 2.7 required, which was not found in the registry
建立一个文件 register.py 内容如下. 然后执行该脚本.
C:\Users\lenovo>python C:\Users\lenovo\Desktop\register.py
=== Python 2.7 is already registered!
over ~
建立一个文件 register.py 内容如下. 然后执行该脚本.
# # script to register Python 2.0 or later for use with win32all # and other extensions that require Python registry settings # # written by Joakim Loew for Secret Labs AB / PythonWare # # source: # http://www.pythonware.com/products/works/articles/regpy20.htm # # modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html 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()然后在运行里执行即可
C:\Users\lenovo>python C:\Users\lenovo\Desktop\register.py
=== Python 2.7 is already registered!
over ~
相关文章推荐
- Python实现二分查找算法
- 根据标识符拆多条url
- Python Elasticsearch api
- 阅读干货-大数据和Python
- Python学习笔记2(小甲鱼)—— 内置函数BIF
- 23 其它话题 - 《Python 核心编程》
- Python 3学习入门一
- 22 扩展Python - 《Python 核心编程》
- 网页源码保存为文件
- 《head first python》——理解数据:列表排序与集合
- python环境安装paramiko模块
- Python学习笔记1(小甲鱼)—— 安装Python3
- python下install django
- python正则表达式笔记
- url中中文转化
- Wing IDE 如何设置 python版本
- 【Python爬虫学习笔记(1)】urllib2库相关知识点总结
- python操作Excel表格读写--xlrd 模块
- 如何在win7下安装python包工具pip
- 用python做一个可以下载电影天堂最新电影的爬虫