安装mysql在check requirements 出现问题 不能继续安装 the requirement is still failing,检测python未安装

原因是重装系统,E盘的python配置到环境变量后,python可以正常使用,但是mysql见此依然说没安装python,

安装mysql在check requirements 出现问题 不能继续安装 the requirement is still failing,检测python未安装_第1张图片

可能是mysql在安装的时候,不是检查环境变量,而是检查注册表。

去注册表路径看看是否 有python

 HKEY_CURRENT_USER\Software\Python\

用python注册注册表;运行下面代码

import sys
 
from winreg import *
 
# tweak as necessary
version = sys.version[:4]
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()
安装mysql在check requirements 出现问题 不能继续安装 the requirement is still failing,检测python未安装_第2张图片

这样注册表中就有python了,检测就通过了。

安装mysql在check requirements 出现问题 不能继续安装 the requirement is still failing,检测python未安装_第3张图片

你可能感兴趣的:(python,mysql)