MySQL-python-1.2.4b4.win32.-py2.7.exe安装失败,无法自动检测到python安装目录
2017-04-28 21:25
471 查看
安装时提示需要python2.7,但是此时python2.7已经添加到环境变量中,要解决这个问题,可以使用如下的方法:
在安装目录下(比如D盘下)新建register.py的文件,内容如下:
然后运行这个python文件
然后在重新安装就没有问题了
在安装目录下(比如D盘下)新建register.py的文件,内容如下:
# # 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()
然后运行这个python文件
然后在重新安装就没有问题了
相关文章推荐
- MySQL-python-1.2.4b4.win32-py2.7提示报错,无法安装的解决方案
- MySQL-python-1.2.4b4.win32-py2.7提示报错,无法安装的解决方案
- 在windows7 64位 安装MySQL-python-1.2.5.win32-py2.7.exe
- windows 安装MySQL-python-1.2.4b4.win32-py2.7提示which was not found in the registry
- 原因:安装MySQL-python-1.2.3.win-amd64-py2.7.exe,时提示:Python version 2.7 required, which was not found in
- pip安装mysql-python报致命错误:my_config.h:没有那个文件或目录
- Eclipse下无法自动编译,或者WEB-INF/classes目录下没文件,编译失败的解决办法
- 包安装失败 ! 无法修改密码,启动报错 ubuntu 12.10 下安装 mysql-5.5.28-linux2.6-x86_64 包,最终回到终端在线安装
- 急求啊!无法安装mysql-5.1.51-win32.msi 到了start service这里它就失败了
- 关于windows x64安装MySQL-python失败解决
- Eclipse下无法自动编译,或者WEB-INF/classes目录下没文件,编译失败的解决办法
- pip 安装 MySQL-python 失败
- Win7 Update更新安装失败或者无法自动更新安装
- 附加自动命名的数据库 但失败。已存在同名的数据库 或指定的文件无法打开或位于 unc 共享目录中。【解决方法】
- Mac下安装mysql-python失败解决方法
- 命令行安装mysql5.7失败(提示信息:MySql服务无法启动.服务没有报告任何错误)
- MySQL Python Windows下的安装经历(失败)
- 附加自动命名的数据库,但失败。已存在同名的数据库,或指定的文件无法打开或位于 UNC 共享目录中[解决方法]
- linux 手工自动安装mysql最新版本tar包步骤(随意指定安装目录且不分散)
- 安装MySQLdb-python时无法找到-lprobes_mysql处理一则