我试着安装mysqlclient,但是它不起作用。
这是错误消息的一部分:
ubuntu@ip-172-31-22-255:~$ sudo pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.1.0.tar.gz (87 kB)
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s8p2sg7z/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-s8p2sg7z/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)
(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-0r3vfxv6
cwd: /tmp/pip-install-s8p2sg7z/mysqlclient/
Complete output (44 lines):
mysql_config --version
['8.0.29']
mysql_config --libs
['-L/usr/lib/x86_64-linux-gnu', '-lmysqlclient', '-lpthread', '-ldl', '-lz', '-lssl', '-lcrypto', '-lresolv', '-lm', '-lrt']
mysql_config --cflags我厌倦了: sudo apt-get install python3 3-dev默认-libmysqlclient构建必需,这是错误消息:
The following packages have unmet dependencies:
python3-dev : Depends: libpython3-dev (= 3.8.2-0ubuntu2) but it is not going to be installed
Depends: python3.8-dev (>= 3.8.2-1~) but it is not going to be installed我试图移除依赖项,但没有任何效果。
发布于 2022-05-31 05:52:02
在安装MySQL客户端之前,您需要在使用pip安装mysql客户机时激活虚拟环境,
https://www.a2hosting.com/kb/developer-corner/mysql/connecting-to-mysql-using-python
此外,请确保您有最新版本的Python。
https://www.a2hosting.com/kb/developer-corner/python/using-a-newer-version-of-python
https://stackoverflow.com/questions/72440642
复制相似问题