博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Python version 2.7 required, which was not found in the registry 问题解决
阅读量:5825 次
发布时间:2019-06-18

本文共 1367 字,大约阅读时间需要 4 分钟。

问题:在安装MySQL-python 1.2.5时出现提示Python version 2.7 required, which was not found in the registry

问题解决如下:执行以下代码,再次安装便可以了!

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

 

转载于:https://www.cnblogs.com/Glf9832/p/6414839.html

你可能感兴趣的文章
android第十一期 - SmoothSwitchLibrary仿IOS切换Activity动画效果
查看>>
zabbix 批量web url监控
查看>>
MongoDB CookBook读书笔记之导入导出
查看>>
shell如何快速锁定所有账号
查看>>
HTML 5实现的手机摇一摇
查看>>
Linux 文件IO理解
查看>>
Ninject 2.x细说---2.绑定和作用域
查看>>
30个非常时尚的网页联系表单设计优秀示例
查看>>
使用membership(System.Web.Security)来进行角色与权限管理
查看>>
opticom 语音质量验证白皮书
查看>>
3D实时渲染中的BSP树和多边形剔除
查看>>
Frank Klemm's Dither and Noise Shaping Page: Dither and Noise Shaping In MPC/MP+
查看>>
网络抓包的部署和工具Wireshark【图书节选】
查看>>
Redis在Windows+linux平台下的安装配置
查看>>
Maven入门实战笔记-11节[6]
查看>>
Local declaration of 'content' hides instance variable
查看>>
ASP.NET中 HTML标签总结及使用
查看>>
Linux下日志系统的设计
查看>>
爬虫IP被禁的简单解决方法——切换UserAgent
查看>>
php生成word,并下载
查看>>