安装mysqldb python2.7中安装mysqldb遇到了一个坑 Microsoft Visual C++ 9.0 is required

安装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)

此时已经安装成功

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值