Collecting mysqlclient
Using cached mysqlclient-2.1.0.tar.gz (87 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/zv/60vkqgms41v8zg76_n8rntg00000gn/T/pip-install-_nlyaw6p/mysqlclient_a781e05976524422b764a6902ff6fe88/setup.py", line 15, in <module>
metadata, options = get_config()
File "/private/var/folders/zv/60vkqgms41v8zg76_n8rntg00000gn/T/pip-install-_nlyaw6p/mysqlclient_a781e05976524422b764a6902ff6fe88/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/private/var/folders/zv/60vkqgms41v8zg76_n8rntg00000gn/T/pip-install-_nlyaw6p/mysqlclient_a781e05976524422b764a6902ff6fe88/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Building wheel for mysqlclient (setup.py) ... error
error: subprocess-exited-with-error
<...>
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
<...>
Running setup.py install for mysqlclient ... error
error: subprocess-exited-with-error
<...>
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
在那之后,我发现了这篇文章,它建议执行这个命令:
# For Debian/ Ubuntu
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
5条答案
按热度按时间eeq64g8w1#
详细信息:https://pypi.org/project/mysqlclient/
s4n0splo2#
相关信息如下:
这就是线索mysql_config:未找到命令
我通过定位命令在我的系统上的位置,并将其添加到
$PATH
来解决问题,在我的情况下如下所示:显然,这条消息的意思是,在$PATH上找不到配置mysql的命令。现在我们知道了。
3yhwsihp3#
简短回答
python3.10-dev
中的python版本应该是你使用的python版本。在我的例子中是3.10
:详情
首先,我运行@levinson的命令:
然后在
pip install -r requirements.txt
中,我得到了其他错误(相互继承):在那之后,我发现了这篇文章,它建议执行这个命令:
但它给我错误,而安装
python3-dev
.之后,我发现有一个python3.x-dev
包,并尝试3.10
版本.它的工作!之后,我只是运行pip install -r requirements.txt
和安装成功.eyh26e7m4#
假设requirements.txt包含一个'import mysql'语句,MySQL documentation帮助可以通过两种方式解决这个问题:
1.由于mysql是一个“虚拟包”,请安装“MySQL-python(Python 2)或mysqlclient(Python 3)”
1.解析OS specific install dependencies
一旦依赖项被安装,你就可以通过安装mysql包来避免代码重写。
x6h2sr285#
不确定这是否仍然有帮助。在我的情况下,我意识到这一点
sudo apt-get install default-libmysqlclient-dev
我安装了mysql客户端,但没有安装mysql服务器。我安装了mysql服务器:
sudo apt install mysql-server
这样就解决了问题