安装mysql for python 2.7

2024-06-17 13:14:00 发布

您现在位置:Python中文网/ 问答频道 /正文

D:\PythonPack\MySQL-python-1.2.3>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "D:\PythonPack\MySQL-python-1.2.3\setup_windows.py", line 7, in get_confi
g
    serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_ke
y'])
WindowsError: [Error 2] The system cannot find the file specified

我正在尝试在windows7中安装mysqldb for python并遇到错误消息

你知道我该怎么做吗?我已经安装了PythonSetup工具


Tags: installinpymostgetsetuplinemysql
2条回答

只需使用here中的exe进行安装。在

也许你可以在前面的问题中找到更多的信息,比如this。在

其实有很多种方法,我试了几个小时才发现它的时间浪费过程bcoz MYSQLdb的版本各不相同,即2.6、2.7和3.2,但所有这些都是混淆和浪费时间的过程, 相反,最好的方法是从:http://www.lfd.uci.edu/~gohlke/pythonlibs获取预编译的可执行文件。 这里选择python2.7和32bit这样的版本链接,这样就不会出现任何错误,现在运行下载的文件,最后在环境变量中设置path。 现在打开python IDLE editor或从命令提示符c:>;python 导入MySQLdb

如果你没有任何错误,那么它工作得很好…享受你的工作

相关问题 更多 >