安装MySQLdb
pip install MySQLdb
出现错误
Could not find a version that satisfies the requirement MySQLdb (from versions:)No matching distribution found for MySQLdb
应该执行的是
pip install MySQL-python
出现
Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
缺少vc的一个库 VCForPython27
链接:https://pan.baidu.com/s/1dcFYzeUXlfo2iJ_K2zTLlw
提取码:jkvf
安装VCForPython27
在执行
pip install MySQL-python
出现
_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
这是因为缺少驱动。
安装MySQL-python-1.2.3.win-amd64-py2.7.exe
链接:https://pan.baidu.com/s/1tfKWnt768D3aIzVhofZ9-Q
提取码:h2lp
再次执行
pip install MySQL-python
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Requirement already satisfied: mysql-python in c:\python27\lib\site-packages (1.2.3)
此时已经安装成功