为什么我在django中从需求文件安装包时出错



大家好,我在ubuntu机器(22.04.1 LTS(上克隆了我的django项目python版本是-3.8.10,django版本是2.2在使用cmdpip-install-r requirements.txt安装包时,安装了一些包后,我出现了错误,据我所知,这是mysqlclient错误

注意mysql数据库运行良好。

请帮帮我。

错误

Collecting mysqlclient==2.0.3
Using cached mysqlclient-2.0.3.tar.gz (88 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: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-490urkf8/mysqlclient_91ecf52f39004862be75d78177e00bdb/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-490urkf8/mysqlclient_91ecf52f39004862be75d78177e00bdb/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-490urkf8/mysqlclient_91ecf52f39004862be75d78177e00bdb/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
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

要么mysql_config不在您的PATH中,要么它没有安装
尝试使用which mysql_config定位它,如果找到它,请将其路径添加到您的path中
否则,请输入所有libmysqlclient-dev
假设您使用的是Ubuntu,请使用:sudo apt -y install libmysqlclient-dev
之后,请尝试再次安装需求。

最新更新