解决安装mysqlclient报错问题:Error:command ‘gcc‘ failed with exit status 1或者 errored out with exit status 1

mysqlclient在python2,3都能直接使用,但是有一个致命缺点就是对mysql安装有要求,必须指定位置存在配置文件。
当我们安装mysqlclient时,可能会各种报错例如:Error:command ‘gcc’ failed with exit status 1或者ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
解决安装mysqlclient报错问题:Error:command ‘gcc‘ failed with exit status 1或者 errored out with exit status 1_第1张图片
或者:
解决安装mysqlclient报错问题:Error:command ‘gcc‘ failed with exit status 1或者 errored out with exit status 1_第2张图片

措施
在Ubuntu或者Deepin下执行下面的命令能解决开发中90%以上的依赖问题:

apt install -y axel build-essential curl default-libmysqlclient-dev dnsutils dos2unix git htop iputils-ping language-pack-zh-hans libbz2-dev libffi-dev libncurses5-dev libpcre3 libpcre3-dev libreadline-dev libsqlite3-dev libssl-dev libxml2-dev libxmlsec1-dev lsof man net-tools nmap openssh-client openssh-server openssl p7zip psmisc python3 python3-dev python3-pip python3-venv rsync ssh sudo sysstat telnet traceroute tree vim wget zip zlib1g-dev zsh

再进行安装mysqlclient:

 pip install mysqlclient

在CentOS下安装mysqlclient出现上面的问题,可进行如下操作:
安装相关依赖mysql-devel和python-devel:

 yum install mysql-devel
yum install python-devel

再进行安装mysqlclient:

 pip install mysqlclient

运行结果:
解决安装mysqlclient报错问题:Error:command ‘gcc‘ failed with exit status 1或者 errored out with exit status 1_第3张图片

拓展:在CentOS下安装MySQL(Mariadb):
安装常用的依赖包:

yum install -y epel-release automake bind-utils bzip2 bzip2-devel curl dos2unix gcc git htop langpacks-zh_CN libffi-devel lsof make man net-tools nmap openssh-server openssl openssl-devel p7zip python36 python36-devel readline-devel rsync sqlite sqlite-devel sudo sysstat telnet tmux traceroute tree vim wget xz zip zlib-devel zsh

安装MySQL:

yum install -y mariadb mariadb-devel mariadb-server

启动MySQL:

systemctl start mariadb

你可能感兴趣的:(错误总结)