成功解决​​​​​​​安装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

解决问题


安装pywin32时出现python version 3.6 required, which was not found in the registry

或者

安装pywin32时出现python version 3.6-32 required, which was not found in the registry


image.png

image.png




解决方法


第一步,打开注册编辑器:regedit


第二步,如图所示,定位到python

image.png




注意:如果没有,则执行下列命令会在注册编辑器里自动生成。

from __future__ import print_function

import sys

try:

   from winreg import *

except ImportError:

   from _winreg import *

# tweak as necessary

version = sys.version[:3]

installpath = sys.prefix

regpath = "SOFTWARE\\Python\\Pythoncore\\{0}\\".format(version)

installkey = "InstallPath"

pythonkey = "PythonPath"

pythonpath = "{0};{1}\\Lib\\;{2}\\DLLs\\".format(

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


相关文章
|
3月前
|
TensorFlow 算法框架/工具 iOS开发
【Python-Tensorflow】ERROR: Could not find a version that satisfies the requirement tensorflow
本文讨论了在安装TensorFlow时遇到的版本兼容性问题,并提供了根据Python版本选择正确pip版本进行安装的解决方法。
322 1
|
3月前
|
API 开发工具 Python
【Azure Developer】使用 Azure Python SDK时,遇见 The resource principal named https://management.azure.com was not found in the tenant China Azure问题的解决办法
【Azure Developer】使用 Azure Python SDK时,遇见 The resource principal named https://management.azure.com was not found in the tenant China Azure问题的解决办法
|
3月前
|
中间件 Python Windows
【Azure 应用服务】Python flask 应用部署在Aure App Service中作为一个子项目时,解决遇见的404 Not Found问题
【Azure 应用服务】Python flask 应用部署在Aure App Service中作为一个子项目时,解决遇见的404 Not Found问题
|
4月前
|
开发者 Python
【Python】已解决:(Python3中pip无法安装urllib报错问题) ERROR: Could not find a version that satisfies the requireme
【Python】已解决:(Python3中pip无法安装urllib报错问题) ERROR: Could not find a version that satisfies the requireme
300 0
【Python】已解决:(Python3中pip无法安装urllib报错问题) ERROR: Could not find a version that satisfies the requireme
|
4月前
|
XML 数据格式 Python
【Python】已解决:xml.parsers.expat.ExpatError: no element found: Line 1, column 0
【Python】已解决:xml.parsers.expat.ExpatError: no element found: Line 1, column 0
105 0
|
4月前
|
开发者 Python
【Python】已解决:(pandas read_excel 读取Excel报错)ImportError: Pandas requires version ‘2.0.1’ or newer of ‘x
【Python】已解决:(pandas read_excel 读取Excel报错)ImportError: Pandas requires version ‘2.0.1’ or newer of ‘x
249 0
|
4月前
|
数据库 Python
【Python】已解决:Pandas requires version ‘1.4.0’ or newer of ‘sqlalchemy’ (version ‘0.7.10’ currently ins
【Python】已解决:Pandas requires version ‘1.4.0’ or newer of ‘sqlalchemy’ (version ‘0.7.10’ currently ins
132 0
|
4月前
|
API 计算机视觉 开发者
【Python】已解决:(pip安装PIL库报错) ERROR: Could not find a version that satisfies the requirement PIL (from v
【Python】已解决:(pip安装PIL库报错) ERROR: Could not find a version that satisfies the requirement PIL (from v
294 0
|
3天前
|
机器学习/深度学习 人工智能 TensorFlow
人工智能浪潮下的自我修养:从Python编程入门到深度学习实践
【10月更文挑战第39天】本文旨在为初学者提供一条清晰的道路,从Python基础语法的掌握到深度学习领域的探索。我们将通过简明扼要的语言和实际代码示例,引导读者逐步构建起对人工智能技术的理解和应用能力。文章不仅涵盖Python编程的基础,还将深入探讨深度学习的核心概念、工具和实战技巧,帮助读者在AI的浪潮中找到自己的位置。
|
3天前
|
机器学习/深度学习 数据挖掘 Python
Python编程入门——从零开始构建你的第一个程序
【10月更文挑战第39天】本文将带你走进Python的世界,通过简单易懂的语言和实际的代码示例,让你快速掌握Python的基础语法。无论你是编程新手还是想学习新语言的老手,这篇文章都能为你提供有价值的信息。我们将从变量、数据类型、控制结构等基本概念入手,逐步过渡到函数、模块等高级特性,最后通过一个综合示例来巩固所学知识。让我们一起开启Python编程之旅吧!