解决centos7安装mysqlclient的错误
报错
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
Collecting mysqlclient Using cached https://pypi.tuna.tsinghua.edu.cn/packages/50/5f/eac919b88b9df39bbe4a855f136d58f80d191cfea34a3dcf96bf5d8ace0a/mysqlclient-2.1.1.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: mysql_config: 未找到命令 /bin/sh: mariadb_config: 未找到命令 /bin/sh: mysql_config: 未找到命令 Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/tmp/pip-install-7vmfn3h6/mysqlclient_eed4d9c102944bb09486e428ccc7c17f/setup.py", line 15, in <module> metadata, options = get_config() File "/tmp/pip-install-7vmfn3h6/mysqlclient_eed4d9c102944bb09486e428ccc7c17f/setup_posix.py", line 70, in get_config libs = mysql_config("libs") File "/tmp/pip-install-7vmfn3h6/mysqlclient_eed4d9c102944bb09486e428ccc7c17f/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-devel,后安装mysqlclient
1 2 |
yum install mysql-devel pip3 install mysqlclient |