python2的mysql。7说Python v2.7未找到
-
12-12-2019 - |
题
我已经下载了mysql-connector-python-1.0.7-py2.7。来自MySQL站点的msi 并尝试安装,但它给出错误
未找到Python v2.7。我们只支持微软Windows安装程序(MSI)python.org...
我正在使用MySQL esssential5.1.66的Windows XP SP3上的官方Python v2.7.3
需要帮助吗???
解决方案 2
我得到这个问题的解决方案是
我已发现将Python添加到注册表中,脚本如下适用于Python v 2.0及更高版本: 注册Python解释器
#
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Low for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
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_LOCAL_MACHINE, regpath)
except EnvironmentError:
try:
reg = CreateKey(HKEY_LOCAL_MACHINE, 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解释器运行它,这是所有!!
其他提示
我在安装时遇到了Windows7下的类似问题 mysql-connector-python-1.0.7-py2.7.msi
和 mysql-connector-python-1.0.7-py3.2.msi
.
从改变后 "Install only for yourself"
到 "Install for all users"
在为windows安装Python时, "python 3.2 not found"
问题消失, mysql-connector-python-1.0.7-py3.2.msi
已成功安装。
我猜问题是mysql连接器安装程序只查找 HKEY_LOCAL_MACHINE
条目,它寻找的东西可能在 HKEY_CURRENT_USER
等。所以直接改变reg表的解决方案也有效。
这个问题主要来自64位windows。下载MySQL的python64位在此链接 http://www.codegood.com/archives/129 和下载 MySQL-python-1.2.3。win-amd64-py2.7。exe(1.0MiB) 这将为python安装MySQL。
视窗10(64位):
事实上,我遇到了类似的问题,无法为MySQL安装python2.7连接器。
在此之前,我已经安装 Python 2.7.15
与 Windows x86-64 MSI installer
,
这是当我 Python 3
安装在我的机器上。
该 Windows x86 MSI installer
做的伎俩,我已经安装到 复盖 以前版本的Python2.7.15,然后安装了连接器(这次它没有给出错误消息)。
如果你还在经历 x64
或其他python模块,我会推荐这个网站 X64/x32的Python扩展
在我的情况下,我仅为我的用户安装了python2.7.14x64。我必须在我的注册表中查找此:
HKEY_CURRENT_USER\Software\Python
, ,导出它们,打开导出的 .reg
文件与文本编辑器,替换所有出现的 HKEY_CURRENT_USER
与 HKEY_LOCAL_MACHINE
, ,并将其导入。
结果是:(记得把安装目录改成你的)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Python]
[HKEY_LOCAL_MACHINE\Software\Python\PythonCore]
[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7]
[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\Help]
[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\Help\Main Python Documentation]
@="D:\\Desarrollo\\entornos\\python27_x64\\Doc\\python2714.chm"
[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\InstallPath]
@="D:\\Desarrollo\\entornos\\python27_x64\\"
[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\InstallPath\InstallGroup]
@="Python 2.7"
[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\Modules]
[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\PythonPath]
@="D:\\Desarrollo\\entornos\\python27_x64\\Lib;D:\\Desarrollo\\entornos\\python27_x64\\DLLs;D:\\Desarrollo\\entornos\\python27_x64\\Lib\\lib-tk"
之后的安装是顺利的.中提琴!
我通过使用32bit python
解决了这个问题