无法安装mysqlclient

来源:5-1 首页问题列表开发

晓芳1

2021-02-09 07:42:38

settings安装mysqlclient报错:ERROR: Command errored out with exit status 1:


Collecting mysqlclient

  Using cached mysqlclient-2.0.3.tar.gz (88 kB)

Using legacy 'setup.py install' for mysqlclient, since package 'wheel' is not installed.

Installing collected packages: mysqlclient

    Running setup.py install for mysqlclient: started

    Running setup.py install for mysqlclient: finished with status 'error'


DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated and has no effect anymore. pip 21.1 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.

    ERROR: Command errored out with exit status 1:

     command: 'C:\Users\Administrator\PycharmProjects\qa_flask2\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-jzuqgb84\\mysqlclient_8ab2d51d2b09405b839a1084debe9237\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-jzuqgb84\\mysqlclient_8ab2d51d2b09405b839a1084debe9237\\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\Administrator\AppData\Local\Temp\pip-record-oo857f9x\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Administrator\PycharmProjects\qa_flask2\venv\include\site\python3.8\mysqlclient'

         cwd: C:\Users\Administrator\AppData\Local\Temp\pip-install-jzuqgb84\mysqlclient_8ab2d51d2b09405b839a1084debe9237\

    Complete output (25 lines):

    running install

    running build

    running build_py

    creating build

    creating build\lib.win32-3.8

    creating build\lib.win32-3.8\MySQLdb

    copying MySQLdb\__init__.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\_exceptions.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb

    creating build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\__init__.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\CR.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\ER.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.8\MySQLdb\constants

    warning: build_py: byte-compiling is disabled, skipping.

    

    running build_ext

    building 'MySQLdb._mysql' extension

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

    ----------------------------------------

ERROR: Command errored out with exit status 1: 'C:\Users\Administrator\PycharmProjects\qa_flask2\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-jzuqgb84\\mysqlclient_8ab2d51d2b09405b839a1084debe9237\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-jzuqgb84\\mysqlclient_8ab2d51d2b09405b839a1084debe9237\\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\Administrator\AppData\Local\Temp\pip-record-oo857f9x\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Administrator\PycharmProjects\qa_flask2\venv\include\site\python3.8\mysqlclient' Check the logs for full command output.

​ 


写回答

1回答

时间,

2021-02-09

同学,你好!使用pip命令安装mysqlclient大多数情况下是会报错的。同学可以在https://pypi.org/project/mysqlclient/#modal-close 该页面中选择相对应的版本进行下载。

http://img.mukewang.com/climg/6021fd1e0983c05d08070296.jpg

在终端中进到所对应的环境中和文件所在的路径中安装就可以了。

http://img.mukewang.com/climg/6021fd3209e426fe09890096.jpg

祝:学习愉快!

0

0 学习 · 2433 问题

查看课程