Python version 2.7 required, which was not found i

不能再注册表中识别出来python2.7

新建一个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/[email protected]/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()

运行py,显示“python 2.7 is already registered”

就能自动识别出来python2.7了。

win7是 64的原因,在安装python(32位)时,如果选择只为当前用户,以上问题是不会出现的,如果选择所有用户,那就用上面的方法解决吧。

时间: 2024-10-29 19:09:04

Python version 2.7 required, which was not found i的相关文章

安装第三方库出现 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 内容如下. 然后执行该脚本. import sys from _winreg import * # tweak as necessary version = sys.version[:3] installpath = sys.prefix regpath = "SOFTWARE\\Python\\Pythonco

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

python registry函数语法 在windows下安装numpy的时候, 出现了"Python version 3.3 required, which was not found in the registry"的错误. 类似的有:Python version 2.7 required, which was not found in the registry 大致意思是说:注册表没有对应的信息. 只要执行一个python脚本,将HKEY_CURRENT_USER (HKCU)注

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

安装setuptools的时候,不能再注册表中识别出来python2.7 在网上找了方法,仅作笔记,供下次使用 方法: 新建一个register.py 文件,把一下代码贴进去,保存(G盘) 1 # 2 # script to register Python 2.0 or later for use with win32all 3 # and other extensions that require Python registry settings 4 # 5 # written by Joak

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

好久不更新随笔了,今天因为数据可视化作业,想抓取一些人人网好友关系数据,于是开始尝试python,用到numpy模块,安装的时候提示: 'Python Version 2.7 required, which was not found in the registry' 发现很多人都遇到这个问题,网上说是官方不支持包,然后给了另外的链接让去下非官方版的,结果没找到囧... 于是发现了这个帖子,直接解决了问题,果断贴过来,帮助其他和我一样遭遇的人儿们. 原帖地址:http://www.xue5.co

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”错误 解决方法 1.任意位置存放reg.py文件 # # script to register Python 2.0 or later for use with win32all # and other extensions that require Python registry setting

【转载】Python Version 2.7 required which was not found in the registry 问题解决

Python Version 2.7 required which was not found in the registry 问题解决 分类: 编程语言2013-07-25 20:45 6172人阅读 评论(4) 收藏 举报 今天在安装numpy时,出现了Python Version 2.7 required which was not found in the registry错误,解决方案如下. Python的一些第三方库只到注册表的HKEY_LOCAL_MACHINE\SOFTWARE\

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 wheel 2.安装lxml.pyopenssl lxml:解析XML的库,很强大,做爬虫BS4,selenium,XPATH都会用到 pip3 install lxml pip3 install pyopenssl 3.安装pywin32 下载网址: https://sourceforge.net

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错误解决 解决: 建立一个文件 register.py 内容如下. 然后执行该脚本. import sys from winreg import * # tweak as necessary version = sys.version[:3] installpath = sys.prefix regpath = "SOFTWARE\\Pyt

为python2.7安装包 RuntimeError: Python version >= 3.5 required.

一台计算机上同时安装了python2.7和python3.7. 现在为python2.7安装numpy包. C:\Python27>python2 -m pip install numpy -i http://mirrors.aliyun.com/pypi/simple/Downloading/unpacking numpy  Downloading numpy-1.18.1.zip (5.4MB): 5.4MB downloaded  Running setup.py egg_info for

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

安装Mysql-python的时候,不能再注册表中识别出来python2.7 方法:新建一个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 / PythonW