环境介绍
python=3.11.9
pip=24.0
mysql=5.5
系统=centos7
错误信息
File "<string>", line 155, in <module>
File "<string>", line 49, in get_config_posix
File "<string>", line 28, in find_package_name
Exception: Can not find valid pkg-config name.
Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
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一些库文件不对应,因此安装mysql8的一些东西
-
1.从mysql官网下载mysql源码
-
mysql-8.4.0-1.el7.x86_64.rpm-bundle.tar
-
2.解压:
tar -xvf mysql-8.4.0-1.el7.x86_64.rpm-bundle.tar -C mysql8 #j解压到mysql8目录,得到如下文件
- 3.安装上图中标记的那个文件
yum localinstall mysql-community-server-8.4.0-1.el7.x86_64.rpm
然后最后再安装mysqlclient顺利完成,如果你的系统上已经有了数据库,上面的操作并不会影响之前的数据库