我正在尝试安装“pip install mysqlclient"而且每次都失败.尝试了所有其他事情,但也没有奏效.我应该怎么办?
我正在尝试 install pip install mysqlclient
并且每次都失败.我也试过 pip install --only-binary :all: mysqlclient
也没有奏效.然后我也下载了whl文件,也没有用.我需要帮助.使用 python 3.7.2 和 pip 19.0.2 版本.这是弹出的整个错误:
I am trying to install pip install mysqlclient
and it fails everytime. I also tried pip install --only-binary :all: mysqlclient
and also not worked. Then I also downloaded whl file and also did't work. I need help.
Using python 3.7.2 and pip 19.0.2 version.
Here's the whole error thats pop up:
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?
错误:需要 Microsoft Visual C++ 14.0.通过MicrosoftVisual C++ 构建工具":https://visualstudio.microsoft.com/downloads/
从错误消息中可以清楚地看出问题在于您的机器上安装了 C++.
From the error message its pretty clear that the issue is with with C++ installation on your machine.
仅供参考:许多 Python 库在幕后使用 C++,因此必须安装错误中提到的 Microsoft Visual c++(在 Windows 上).您可以从此处继续安装 Microsoft Visual C++> 或 此处
FYI: Many Python libs uses C++ under the hood so its mandatory to install the Microsoft visual c++(on windows) as mentioned in the error. You can go ahead and install Microsoft Visual C++ from here or here
否则,如果 mysqlclient 没有特殊用途,您可以使用名为 PyMySQL的纯 pyython MySQL 客户端库a>(您无需安装 Visual C++ 即可使用此库).
Or else if there is no particular use behind mysqlclient you can use this pure pyython MySQL client library named PyMySQL (you need not install visual c++ for using this lib).