`
美丽的小岛
  • 浏览: 308209 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

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

 
阅读更多
#
# 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()

 



 

 

  • 大小: 90.8 KB
分享到:
评论

相关推荐

    成功解决​​​​​​​安装pywin32时出现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 目录 解决问题 解决方法 第一步,打开注册编辑器:regedit 第二步,如图所示,定位到python 第三步,把注册表中文件夹...

    MySQL-python-1.2.3 32/64位windows for python2.7

    32/64位windows,python2.7用的MySQL-python 解决安装MySQL-python出现的:Python version 2.7 required, which was not found in the registry

    python及paramiko模块安装包

    安装pycrypto-2.6.win32py2.7.exe时会报“Python version 2.7 required, which was not found in the registry ”时请按照:http://www.cnblogs.com/min0208/archive/2012/05/24/2515584.html上操作即可。...

    win64 pyhton64 scrapy成功安装教程及插件

    解决Python version 2.7 required, which was not found in the registry 内有安装scrapy win64位安装教程及所有安装插件,成功安装 1.python-2.7.8.amd64.msi 2.pywin32-219.win-amd64-py2.7.exe 3.zope.interface-...

    python2.7和NLTK安装详细教程

    2、安装时会出现以下错误:Python version 2.7 required, which was not found in the registry。 解决办法: (1)新建一个register.py文件,把以下代码粘贴进去,保存到D盘。 # script to register Python 2.0 or ...

    fixRegistry.reg

    解决安装PyWin32问题:Python version x.x required, which was not found in the registry.

    安装python时MySQLdb报错的问题描述及解决方法

    windows安装python mysqldb时报错python version 2.7 required,which was not found in the registry 网上很多方案,比如方案一: Python3.x时, from _winreg import * 改为 from winreg import * 去掉下划线 ...

    NLTK 3.2.4 环境搭建教程

    从网站下载,完成后双击安装,但提示Python version -32 required, which was not found in the registry. 从网上搜索到以下解决方案: 新建文件D:\register.py,通过脚本建立注册信息 #===============register....

    win10 64bit下python NLTK安装教程

    - **Python未在注册表中注册的问题**:当执行pip安装命令时,如果遇到错误提示“Python version 2.7 required, which was not found in the registry”,可以采取以下解决方法: 1. 创建一个名为`register.py`的...

Global site tag (gtag.js) - Google Analytics