• 安装python的pywin32安装不了,提示找不到py3.6-32


    安装python的pywin32安装不了,提示找不到py3.6-32

    首先我自己的py3.6是64位版本的,这是pywin32模块的下载地址

    里面有各种版本的,首先我先下了64位的3.6版本的,结果提示这里写图片描述这里写图片描述

    解决方法(亲测有效):

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

    运行这段代码以后可以自动将py3.6安装目录直接添加进注册表,检查了下注册表,的确出现了。

    然后我在试了下64位的exe文件,还是提示找不到注册表。

    然后打开注册表,win+R键,之后输入regedit 
    找到这里这里写图片描述 
    将3.6改为3.6-32,这样就可以进行安装了

     
  • 相关阅读:
    Appium运行时,error: Logcat capture failed: spawn ENOENT的解决办法
    pwntools使用简介3
    pwntools使用简介2
    pwnable.kr memcpy之write up
    pwnable.kr uaf之wp
    【笔记】objdump命令的使用
    pwnable.kr cmd2之write up
    pwnable.kr cmd1之write up
    pwnable.kr lotto之write up
    pwnable.kr blackjack之write up
  • 原文地址:https://www.cnblogs.com/liu--huan/p/10722760.html
Copyright © 2020-2023  润新知