【发布时间】:2019-07-10 10:52:31
【问题描述】:
我正在尝试install pip install mysqlclient,但每次都失败。我也试过pip install --only-binary :all: mysqlclient 也没有工作。然后我还下载了 whl 文件,也没有工作。我需要帮助。
使用 python 3.7.2 和 pip 19.0.2 版本。
这是弹出的整个错误:
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command c:\users\vertig~1.0\envs\mypro\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\VERTIG~1.0\\AppData\\Local\\Temp\\pip-install-b81i8gmq\\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\VERTIG~1.0\AppData\Local\Temp\pip-record-6s1gmot9\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\vertig~1.0\envs\mypro\include\site\python3.7\mysqlclient:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
Command "c:\users\vertig~1.0\envs\mypro\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\VERTIG~1.0\\AppData\\Local\\Temp\\pip-install-b81i8gmq\\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\VERTIG~1.0\AppData\Local\Temp\pip-record-6s1gmot9\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\vertig~1.0\envs\mypro\include\site\python3.7\mysqlclient" failed with error code 1 in C:\Users\VERTIG~1.0\AppData\Local\Temp\pip-install-b81i8gmq\mysqlclient\```
So any ideas where the error is getting?
【问题讨论】:
-
由于您是新的贡献者,我建议您始终将错误消息与您的问题一起发布。否则没有人能真正帮助你。更好地编辑您的问题并添加您收到的错误消息。还要添加你正在使用的 pip 和 mysql 版本。
-
如果可以,安装 64 位 Python 3.7.x。 Windows 上有一个 64 位 Python 3.7 的官方轮子。如果您使用 32 位 Python,则必须从源代码(这可能很棘手)或 install an unofffical wheel 安装。
-
@Alasdair 我已经安装了 64 it python 并且还下载了 64 位 wheel 文件。并且还在 cmd 中尝试过这个:
pip install mysqlclient-1.4.2-cp37-cp37m-win_amd64它显示了这个:Could not find a version that satisfies the requirement mysqlclient-1.4.2-cp37-cp37m-win_amd64 (from versions: ) No matching distribution found for mysqlclient-1.4.2-cp37-cp37m-win_amd64 -
@hackSlanger 请问如何在cmd中查看我的mysql版本
-
如果你想安装一个下载的轮子,那么你需要包含
.whl的完整文件名。
标签: python mysql django python-3.x pip