问题:linux centos 环境下,django项目安装mysqlclient报错:
(v_env) [pyapp: /home/userpy/workspace/v_env>pip install --upgrade mysqlclient --trusted-host mirrors.aliyun
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes:
Collecting mysqlclient
Using cached .1. (88 kB)
Installing build dependencies … done
Getting requirements to build wheel … error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
mysql_config --version
mariadb_config --version
mysql_config --libs
Traceback (most recent call last):
File “/home/pyapp/.local/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”, line 353, in
main()
File “/home/pyapp/.local/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”, line 335, in main
json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
File “/home/pyapp/.local/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”, line 118, in get_requires_for_build_wheel
return hook(config_settings)
File “/tmp/pip-build-env-j0x3q10s/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”, line 341, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[‘wheel’])
File “/tmp/pip-build-env-j0x3q10s/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”, line 323, in _get_build_requires
self.run_setup()
File “/tmp/pip-build-env-j0x3q10s/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”, line 487, in run_setup
super(_BuildMetaLegacyBackend,
File “/tmp/pip-build-env-j0x3q10s/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”, line 338, in run_setup
exec(code, locals())
File “”, line 15, in
File “/tmp/pip-install-6m8hen1c/mysqlclient_d8b328b884704898962d255b91cc2dcf/setup_posix.py”, line 70, in get_config
libs = mysql_config(“libs”)
File “/tmp/pip-install-6m8hen1c/mysqlclient_d8b328b884704898962d255b91cc2dcf/setup_posix.py”, line 31, in mysql_config
raise OSError(“{} not found”.format(_mysql_config_path))
OSError: mysql_config not found
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
解决:
在尝试安装 mysqlclient
时遇到了问题。错误信息显示,安装过程中找不到 mysql_config
命令。这通常是因为您的系统中没有安装 MySQL 或 MariaDB 开发库。
在 CentOS 系统中,您可以通过以下命令安装这些库:
sudo yum install mysql-devel
如果您使用的是 MariaDB:
sudo yum install mariadb-devel
在安装了这些库之后,您应该就可以成功安装 mysqlclient
了。
本文发布于:2024-02-04 20:04:13,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170715434959167.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |