python3.7安装模块MySQLdb报错error: Microsoft Visual C++ 14.0 is required.

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

----------------------------------------
Command "c:\users\lyn\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\LYN\\AppData\\Local\\Temp\\pip-install-tj4h87_l\\mysql-python\\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\LYN\AppData\Local\Temp\pip-record-qr8kh7_p\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\LYN\AppData\Local\Temp\pip-install-tj4h87_l\mysql-python\

我的python版本信息为:

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32

解决办法:下载whl文件手动安装

下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

选择版本(选择的版本cp后的值要和python版本对应,否则会报错“is not a supported wheel on this platform.”)

到下载目录下执行命令

  • pip3 install .\MySQL_python-1.2.5-cp37-none-win32.whl

关于下载的whl文件在安装时报错“is not a supported wheel on this platform.”网上还有一种直接修改whl文件名的方法,虽然我亲测无效,但是还是列在此处

如果选择的版本为

需要把文件名改为

猜你喜欢

转载自www.cnblogs.com/VeryGoodVeryGood/p/9396911.html