Python version 2.7, which was not found in the registry
在安装部分Python包时会出现问题:明明已经安装了Python2.7,但无法在注册表相关位置找不到,那该怎么感觉该问题呢?
首先检查你的系统位数,位数不同,解决方案不一样。
1)32位系统:在cmd输入regedit然后将HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath路径下的值,复制到HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath路径下,当然没有路径的话一定要新建起来。然后就可以安装了。本解决方案适用于只提供了32位安装包的库。
原因:Python的一些第三方库只到注册表的HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath路径下寻找Python。但是装好的64位Python在HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath路径下建立Python的信息。
2)64位系统:将Python2.7加入到注册表中。可以通过运行下面代码:
- 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():
- print "begin RegisterPy "
- try:
- print "open key : %s"%regpath
- 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 "*** EXCEPT: 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 "*** ERROR:Unable to register!"
- print "*** REASON:You probably have another Python installation!"
- def UnRegisterPy():
- #print "begin UnRegisterPy "
- try:
- print "open HKEY_CURRENT_USER key=%s"%(regpath)
- reg = OpenKey(HKEY_CURRENT_USER, regpath)
- #reg = OpenKey(HKEY_LOCAL_MACHINE, regpath)
- except EnvironmentError:
- print "*** Python not registered?!"
- return
- try:
- DeleteKey(reg, installkey)
- DeleteKey(reg, pythonkey)
- DeleteKey(HKEY_LOCAL_MACHINE, regpath)
- except:
- print "*** Unable to un-register!"
- else:
- print "--- Python", version, "is no longer registered!"
- if __name__ == "__main__":
- RegisterPy()
Python version 2.7, which was not found in the registry的更多相关文章
- Python 安装Twisted 提示python version 2.7 required,which was not found in the registry
由于我安装Python64位的,下载后没注册,安装Twisted时老提示“python version 2.7 required,which was not found in the registry ...
- 【亲测】Python:解决方案:Python Version 2.7 required, which was not found in the registry
好久不更新随笔了,今天因为数据可视化作业,想抓取一些人人网好友关系数据,于是开始尝试python,用到numpy模块,安装的时候提示: 'Python Version 2.7 required, wh ...
- 96、python version 3.6 required,which was not fount in the registry(python3.6安装scrapy)
在安装scrapy时遇到问题 环境:win10(64位), Python3.6(64位) 安装scrapy: 1.安装wheel(安装后,便支持通过wheel文件安装软件) pip3 install ...
- python version 3.6 required,which was not fount in the registry(python3.6安装scrapy)
在安装scrapy时遇到问题 环境:win10(64位), Python3.6(64位) 安装scrapy: 1.安装wheel(安装后,便支持通过wheel文件安装软件) pip3 install ...
- 安装pywin32出现--Python version 3.x required, which was not found in the registry
这两天安装pywin32时出现了这个问题 双击.exe文件进入安装界面,然后点击下一步,它会自动定位你的python安装在什么地方,但是我的安装过程中未自动定位到python安装位置,并显示显示: 安 ...
- 【转】安装第三方库出现 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 内容如下. 然 ...
- 安装第三方库出现 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 内容如下. 然 ...
- Python version 3.6 required, which was not found in the registry错误解决
问题: 安装pywin32出现Python version 3.6 required, which was not found in the registry错误解决 解决: 建立一个文件 regis ...
- 安装 pywin32-218.win32-py2.7.exe 报错python version 2.7 required,which was not found in the registry解决方案
随便在一个盘下 新建register.py的文件,内容如下: # # script to register Python 2.0 or later for use with win32all ...
随机推荐
- JDK7+EclipseIDE+Tomcat7.0.55++mybatis3+Maven3.2.2 构建webapp 的java 的maven项目
构建Maven项目 工具 JDK7+EclipseIDE+Tomcat7.0.55++mybatis3+Maven3.2.2 JDK 下载地址 http://www.oracle.com/techne ...
- 写给前端的Python依赖管理指北
概述 在Python的项目中,我们可以通过pip来安装依赖包,但是不像npm install,pip默认安装的依赖包会挂在全局上,不利于项目工程协作. 这时候需要一款类似npm的工具记录我们的项目依赖 ...
- jGrid + echart 后台管理
用来初始化表的大小: $(select_dom).jqGrid( 'setGridWidth', parent_column.width() ); 表的大小随着页面的宽度变化: $(window).o ...
- Tqdm 进度条可视化模块
2018-12-04 14:34:25 使用python Tqdm进度条库让你的python进度可视化 Tqdm在阿拉伯语表示进步,在西班牙语中表示我非常爱你.是一个快速,可扩展的Python进度条, ...
- Windows 7 Update Settings Disabled (Important Updates Grayed Out)
This worked for me: 1) Hold WindowsKey + R (is hold Start & press R on your keyboard) 2) Typ ...
- canvas学习之小球动画
项目地址:http://pan.baidu.com/s/1skZGPgL 最近学习使用canvas做动画效果,主要原理就是创建一个小球对象,然后小球对象有一个moveball方法,每次让小球沿着随机路 ...
- BFS+二进制状态压缩 hdu-1429
好久没写搜索题了,就当练手吧. vis[][][1025]第三个维度用来维护不同key持有状态的访问情况. 对于只有钥匙没有对应门的位置,置为'.',避免不必要的状态分支. // // main.cp ...
- anaconda安装tensorflow
1.下载anaconda python3.5版本,Windows不支持python3.6,linux和mac支持python2.7和python3.3+ 2.创建环境 conda create - ...
- Symmetric Tree leetcode java
问题描述: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). ...
- 廖雪峰网站:学习python函数—函数参数(三)
1.*args # 位置参数,计算x2的函数 def power(x): return x * x p = power(5) print(p) # 把power(x)修改为power(x, n),用来 ...