building 'MySQLdb._mysql' extension   error: Microsoft Visual C++ 14.0 is required. Get it with "Mi

这几天电脑实验室坏了。。。。emmm,每次想好好做东西的时候,电脑就坏掉。。这次是连不上网,然后尝试修复之后,把pycharm也成功搞坏。。。。very good!!! 好吧,我用笔记本行了吧。。结果在笔记本上安装mysqlclient包时又报一堆错。。。。。啊,为什么要这样对我这样可爱的女孩子下手(滑稽)

首先报错为:


  running build_ext
  building 'MySQLdb._mysql' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

  ----------------------------------------
  Failed building wheel for mysqlclient

它的意思是说没有安装Microsoft Visual C++ 14.0  

方法(一):

然后我就去下载了一个,下载地址为:https://pan.baidu.com/s/1WaBxFghTll6Zofz1DGOZBg

(参考:https://blog.csdn.net/qq_20159855/article/details/79685003

安装成功:

然后有些人就可以pip install mysqlclient了,我的不行,你们可以试试。

安装完后又出现第二个错误。。。。想哭。。。

Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win-amd64-3.6\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
    _mysql.c
    MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-y76fnk5t\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\DELL\AppData\Local\Temp\pip-record-09pg5nxh\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\DELL\AppData\Local\Temp\pip-install-y76fnk5t\mysqlclient\
You are using pip version 10.0.1, however version 19.2.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

这个问题我也不知道怎么解决,可以参考一下这个:http://www.mamicode.com/info-detail-2169894.html

然后我就放弃这种方法了。。。。

 

方法(二):
最后实在没办法就用最原始的办法碰碰运气(刚开始搜别人的解决方案都说这样不行,所以我就没试试),那就是在组件库里先下载需要的组件,然后再安装。下载地址为:https://www.lfd.uci.edu/~gohlke/pythonlibs/

我的python版本为3.6的所以我下了
 这个,然后在dos命令中输入:

pip install C:\Users\DELL\Downloads\mysqlclient-1.4.4-cp36-cp36m-win_amd64.whl

install后面的是你离线包的存储地址。

 

然后居然成功了。。。。。3个小时居然。。。。(手动狗头)

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值