gpt4 book ai didi

python - aws ubuntu 20.04 mysqlclient 无法安装

转载 作者:行者123 更新时间:2023-12-04 19:24:30 27 4
gpt4 key购买 nike

我试图安装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-dev default-libmysqlclient-dev build-essential
这是错误消息:
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
我试图删除依赖项,但没有任何效果

最佳答案

在安装 MySQL Client 之前,您需要在使用 pip 安装 mysql-client 时激活虚拟环境,
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

关于python - aws ubuntu 20.04 mysqlclient 无法安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72440642/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com