yanchuen 发表于 2017-4-27 11:47:46

Python安装MySQLdb问题(win7 32位)

  问题描述:由于之前使用python3.2.2版本,使用很多第三方库不方便,就将python重装为python2.7.4版本,当时装的MySQLdb也忘了,现在到使用时才想起要重装MySQLdb,就用pip install mysql-python直接安装,但是报错,如下图
  环境工具:Win7(32bit)  Python2.7.4
  解决过程:看到一篇英文技术文章,部分摘录如下
  Installing mysql module for python
I rate this mission as : impossible for the everyday developer on windows.
Here are several of the problems I got along the way :
  _mysql.c:34:24: fatal error: config-win.h: No such file or directory
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key'])
WindowsError: The system cannot find the file specified
error: Unable to find vcvarsall.bat

Save yourself the headache -
Search for a "download compiled python 2.7 mysql for windows"
change the query to your python version.
Do not stop until you find a file named
"MySQL-python-1.2.3.win32-py2.7.exe"

again - version might be different.

Do not go on the mission of installing it by yourself, it is simply a nightmare.
  意思就是说下载已经针对win7 32编译好的MySQLdb来安装
  想起来,之前的MySQLdb也不是通过pip安装的,只好去下载一个MySQL-python-1.2.3.win32-py2.7.exe来安装,很快OK。
页: [1]
查看完整版本: Python安装MySQLdb问题(win7 32位)