pip install mysql-python 安装错误解决方案,whl安装,exe 安装

 正确解决方式:

如果是在windows环境下安装的话那么可以直接下载一个安装程序来安装已经编译好的模块。比如去【http://www.codegood.com/downloads】下载。

https://www.cnblogs.com/franknihao/p/7267182.html

=====================================================

失败的解决案例一:

首先从https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal下载MySQL-python驱动

那么我们不下载MySQL_python‑1.2.5‑cp27‑none‑win32.whl ,去下载MySQL_python‑1.2.5‑cp27‑none‑win_amd64.whl

下载后文件放到C:Python27,然后开始安装,

c:Python27>pip install C:Python27MySQL_python-1.2.5-cp27-none-win_amd64.whl

发现安装失败了,ERROR: MySQL_python-1.2.5-cp27-none-win_amd64.whl is not a supported wheel on this platform.

———————————————

失败的解决案例二:

C:Userslin26>pip install mysql-python 

Running setup.py install for mysql-python ... error
ERROR: Command errored out with exit status 1:
command: 'c:program filespythonpython.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] =
'"'"'C:\Users\lin26\AppData\Local\Temp\pip-install-gpn4j3c1\mysql-python_4fc8e8e2440d4e86b9373d429b8c6634\
setup.py'"'"'; __file__='"'"'C:\Users\lin26\AppData\Local\Temp\pip-install-gpn4j3c1\mysql-python_4fc8e8e244
0d4e86b9373d429b8c6634\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__fi
le__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"' '"'"', '"
'"' '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:Userslin26AppDataLoca
lTemppip-record-iz_1sfbpinstall-record.txt' --single-version-externally-managed --user --prefix= --compile --in
stall-headers 'C:Userslin26AppDataRoamingPythonPython38Includemysql-python'
cwd: C:Userslin26AppDataLocalTemppip-install-gpn4j3c1mysql-python_4fc8e8e2440d4e86b9373d429b8c6634

Complete output (24 lines):
running install
running build
running build_py
creating build
creating buildlib.win-amd64-3.8
copying _mysql_exceptions.py -> buildlib.win-amd64-3.8
creating buildlib.win-amd64-3.8MySQLdb
copying MySQLdb\__init__.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdbconverters.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdbconnections.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdbcursors.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdb elease.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdb imes.py -> buildlib.win-amd64-3.8MySQLdb
creating buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstants\__init__.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsREFRESH.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win-amd64-3.8MySQLdbconstants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio
.microsoft.com/downloads/

----------------这里是真正错误,去http://go.microsoft.com/fwlink/?LinkId=691126把系统安装一些最新c++框架------------------------------------

https://support.microsoft.com/zh-cn/topic/%E6%9C%80%E6%96%B0%E6%94%AF%E6%8C%81%E7%9A%84-visual-c-%E4%B8%8B%E8%BD%BD-2647da03-1eea-4433-9aff-95f26a218cc0

x64: vc_redist.x64.exe  这个可以bylin

C:Userslin26AppDataLocalTemppip-record-iz_1sfbpinstall-record.txt' --single-version-externally-managed --use
r --prefix= --compile --install-headers 'C:Userslin26AppDataRoamingPythonPython38Includemysql-python' Check
the logs for full command output.