在安装部分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的更多相关文章

  1. 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 ...

  2. 【亲测】Python:解决方案:Python Version 2.7 required, which was not found in the registry

    好久不更新随笔了,今天因为数据可视化作业,想抓取一些人人网好友关系数据,于是开始尝试python,用到numpy模块,安装的时候提示: 'Python Version 2.7 required, wh ...

  3. 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 ...

  4. 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 ...

  5. 安装pywin32出现--Python version 3.x required, which was not found in the registry

    这两天安装pywin32时出现了这个问题 双击.exe文件进入安装界面,然后点击下一步,它会自动定位你的python安装在什么地方,但是我的安装过程中未自动定位到python安装位置,并显示显示: 安 ...

  6. 【转】安装第三方库出现 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 内容如下. 然 ...

  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 建立一个文件 register.py 内容如下. 然 ...

  8. 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 ...

  9. 安装 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    ...

随机推荐

  1. 两排序数组的中位数 Median of Two Sorted Arrays

    2018-11-18 23:33:28 问题描述: 问题求解: 这个问题是一个比较有难度的可以使用二分搜索法求解的问题,如果采用朴素的解法进行merge再找中位数的话,其时间复杂度为O(n1 + n2 ...

  2. Nginx自学笔记

    Nginx相关 标签(空格分隔): nginx 享学 安装部署 通过源代码的方式安装 使用 ./sbin/nginx #启动 ./sbin/nginx -t #检查是否有错 ./sbin/nginx ...

  3. eQTL | Expression quantitative trait loci | 数量性状位点 | 表达数量性状基因座

    一篇通俗的文章:eQTL Expression quantitative trait loci (eQTLs) are genomic loci that explain all or a fract ...

  4. Linux ----> debian中环境的常见配置

    环境: (debian 9)/(lubuntu18.0.4+virtualbox) 1.配置下载源: gedit /etc/apt/sources.list #163 deb http://mirro ...

  5. LeetCode--437--路径总和3

    问题描述: 给定一个二叉树,它的每个结点都存放着一个整数值. 找出路径和等于给定数值的路径总数. 路径不需要从根节点开始,也不需要在叶子节点结束,但是路径方向必须是向下的(只能从父节点到子节点). 二 ...

  6. p2751 Job Processing

    如果单单只安排过程1的时间最短,很容易算出来.用优先队列取最小,加上增量后再放回就行.对过程2也进行这样的操作.将过程1第一个完成的在过程2最后一个完成.以样例来说,过程1:1,1,2,2,3,过程2 ...

  7. 安装 zookeeper cluster

    安装 zookeeper cluster zookeeper-3.4.5.tar.gz n0 10.69.10.193 n1 10.69.10.188 n2 10.69.10.192 n0 上解压 z ...

  8. textarea点击蓝色背景,黄色条,input点击黄色条,如何去掉?

    textarea:focus{ background: #ffff outline:none; } input:focus{ oulilne:none; }

  9. vuex之单向数据流

    单向数据流 State State 用来存状态.在根实例中注册了store 后,用 this.$store.state 来访问. Getters Getters 从 state 上派生出来的状态.可以 ...

  10. S-Nim HDU - 1536

    #include<iostream> #include<cstdio> #include<cstring> #include<vector> using ...