May*_*til 12 python mysql python-2.7 mysql-connector-python
我从MySQL站点下载了mysql-connector-python-1.0.7-py2.7.msi并尝试安装,但它给出了错误
找不到Python v2.7.我们只支持python.org上的Microsoft Windows Installer(MSI).
我使用MySQL esssential5.1.66在Windows XP SP3上使用官方Python v 2.7.3
需要帮忙 ???
小智 10
我安装时,在Windows 7下遇到了类似的问题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"安装Python for Windows时,"python 3.2 not found"问题消失并mysql-connector-python-1.0.7-py3.2.msi成功安装.
我想问题是mysql连接器安装程序只查找HKEY_LOCAL_MACHINE条目,它查找的东西可能在HKEY_CURRENT_USER等等.所以直接更改reg表的解决方案也可以.
我遇到这个问题的解决方案是
我发现将Python添加到Registry,适用于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()
Run Code Online (Sandbox Code Playgroud)
用任何名字保存.从python解释器运行它,并且全部!
小智 5
这个问题主要是64位窗口.在此链接http://www.codegood.com/archives/129下载MySQL for python 64位并下载 MySQL-python-1.2.3.win-amd64-py2.7.exe(1.0 MiB) 这将安装MySQL for蟒蛇.
Windows 10(64位):
确实,我遇到了类似的问题,无法为MySQL安装python 2.7连接器.
在此之前我安装Python 2.7.15了Windows x86-64 MSI installer,
这是我Python 3在我的机器上安装的时候.
该Windows x86 MSI installer做的伎俩,我已经安装了它覆盖的Python 2.7.15之前的版本,然后安装在连接器(这一次没有给出错误消息).
| 归档时间: |
|
| 查看次数: |
18459 次 |
| 最近记录: |