数据库
首页 > 数据库> > 为python 2.7安装mysql

为python 2.7安装mysql

作者:互联网

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中为python安装mysqldb并遇到该错误消息

您是否知道我如何使它工作?我已经安装了pythonsetuptool

解决方法:

其实有很多方法,我尝试了几个小时才意识到它的时间浪费过程,因为各个版本的Bcoz MYSQLdb有所不同,即2.6、2.7和3.2,但是所有这些都是混乱和浪费时间的过程,
最好的方法是从http://www.lfd.uci.edu/~gohlke/pythonlibs获取预编译的可执行文件.
在这里选择版本明智的链接(例如python 2.7和32bit),这样您就不会出现任何错误,现在运行下载的文件,最后在环境变量中设置路径.
现在打开python IDLE编辑器或从命令提示符c:> python
导入MySQLdb

如果您没有任何错误,那就很好…享受您的工作

标签:python-2-7,installation,windows,python
来源: https://codeday.me/bug/20191201/2079186.html