搜索
您的当前位置:首页正文

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  

方法(一):

(参考:)

安装成功:

然后有些人就可以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.

这个问题我也不知道怎么解决,可以参考一下这个:

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

 

我的python版本为3.6的所以我下了

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

 

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

因篇幅问题不能全部显示,请点此查看更多更全内容

Top