pip install mysqlclient安装mysqlclient的时候报错


每次换到不同的机器上,需要安装python的虚拟环境之后,都要安装对应的pip的第三方库. 在安装其中一个mysqlclient库的时候经常出现没有安装依赖库,导致安装mysqlclient失败. 不同的业务系统报错和安装依赖的库还不一样. 报错信息如下: pip  instll   mysqlclient安装报错信息

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库的依赖库,要根据操作系统来安装:

DEBIAN系统(包括树莓派raspiberrey):

`在raspi4b上面如果需要安装mysqlclient的包

必须在之前安装下面的包

sudo apt-get install default-libmysqlclient-dev

apt-get install build-essential`

CENTOS系统: mysqlclient安装失败要先安装mysql-devel

yum install mysql-devel python3-devel gcc

基本上安装完上述的依赖,mysqlclient就可以顺利安装了.