错误提示为:
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 "d:\anakin\testvir\scripts\python.exe -u -c "import setuptools, tokenize
;__file__='C:\\Users\\dongyic\\AppData\\Local\\Temp\\pip-install-2awumha6\\mysql
-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().rep
lace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --re
cord C:\Users\dongyic\AppData\Local\Temp\pip-record-1dfat2_4\install-record.txt
--single-version-externally-managed --compile --install-headers d:\anakin\testvi
r\include\site\python3.7\mysql-python" failed with error code 1 in C:\Users\dong
yic\AppData\Local\Temp\pip-install-2awumha6\mysql-python\
解决办法:
下载mysql-python驱动:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
找到Mysqlclient
或者MySQL-python
, 点击下载对应的版本
安装驱动
>pip install mysqlclient-1.3.12-cp37-cp37m-win_amd64.whl
cp37表示支持的python版本为python3.7,注意不要下载错了