我安装了python最新版本python3.10.0
和django 3.2.8。我试图通过在命令提示符中使用pip install mysqlclient
命令来安装mysqlclient,但它显示了如下错误:
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'F:djangojobvenvScriptspython.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\IIITK2\AppData\Local\Temp\pip-install-ja9ipfah\mysqlclient_08057cd8bc0f44f5bca353c6775cb063\setup.
py'"'"'; __file__='"'"'C:\Users\IIITK2\AppData\Local\Temp\pip-install-ja9ipfah\mysqlclient_08057cd8bc0f44f5bca353c6775cb063\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io
.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersIIITK2AppDataLocalTemppip-wheel-p39k
z555'
cwd: C:UsersIIITK2AppDataLocalTemppip-install-ja9ipfahmysqlclient_08057cd8bc0f44f5bca353c6775cb063
Complete output (23 lines):
running bdist_wheel
running build
running build_py
creating build
creating buildlib.win-amd64-3.10
creating buildlib.win-amd64-3.10MySQLdb
copying MySQLdb__init__.py -> buildlib.win-amd64-3.10MySQLdb
copying MySQLdb_exceptions.py -> buildlib.win-amd64-3.10MySQLdb
copying MySQLdbconnections.py -> buildlib.win-amd64-3.10MySQLdb
copying MySQLdbconverters.py -> buildlib.win-amd64-3.10MySQLdb
copying MySQLdbcursors.py -> buildlib.win-amd64-3.10MySQLdb
copying MySQLdbrelease.py -> buildlib.win-amd64-3.10MySQLdb
copying MySQLdbtimes.py -> buildlib.win-amd64-3.10MySQLdb
creating buildlib.win-amd64-3.10MySQLdbconstants
copying MySQLdbconstants__init__.py -> buildlib.win-amd64-3.10MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win-amd64-3.10MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win-amd64-3.10MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win-amd64-3.10MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win-amd64-3.10MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win-amd64-3.10MySQLdbconstants
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/
有人能说一个解决方案吗?
mysqlclient 2.1.0版本Mysqlclient 2.0.3不支持python 3.10版本
现在执行命令pip install mysqlclient
按照官方说明,Ubuntu运行:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
Ubuntu需要这个OS包来安装python包mysqlclient
:
sudo apt install libmysqlclient-dev
使用python 3.10版本的用户可以使用此链接下载轮子,否则会出现错误。打开img来知道你要点击哪个链接