zoukankan      html  css  js  c++  java
  • 安装pywin32时,出现找不到python27注册信息的解决办法

    1. 检查一下注册表是否存在python其它版本的信息

    方法:

    1)在命令行中输入regedit打开注册表

    2)在HKEY_CURRENT_USERSoftware中找一下是否存在python注册信息,如果存在,检查一下是否是python27版本,且是否包含下面两个节点

    再检查一下其对于的安装路径是否正确。如果不知道如何检查,可以把python节点信息右击选择删除。如果python注册信息不存在,这里就不用操作了。

    2.执行下面链接中的python脚本(python27使用正常,无需修改任何内容)

    3.执行后再检查一下注册表。如下

    4. 再次安装pywin32-220.win32-py2.7.exe,结果安装成功


    另一外一种方法:就是执行下面的python脚本

    # 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()



  • 相关阅读:
    WebQQ2.0 PHP
    HTML文档类型 PHP
    字符●圆角 PHP
    IIS日志分析器 PHP
    JS 像素数字 PHP
    3DTagCloud3D标签云 PHP
    QQ截屏工具提取 PHP
    .NET嵌入DLL ILMerge工具应用 PHP
    JS CSS 压缩工具(GUI界面) PHP
    Javascript 函数初探
  • 原文地址:https://www.cnblogs.com/feixiablog/p/7999542.html
Copyright © 2011-2022 走看看