python3安装mysqlclient报错,各种依赖都齐全==ERROR: Command errored out with exit status 1:

一、描述

在centos7.5中执行pip3 install mysqlclient,报如下错误

[root@VM_0_10_centos data]# pip3 install mysqlclient

WARNING: Running pip install with root privileges is generally not a good idea. Try pip3 install --user instead.

Collecting mysqlclient

Downloading http://mirrors.tencentyun.com/pypi/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz (85kB)

100% |████████████████████████████████| 92kB 793kB/s

Building wheels for collected packages: mysqlclient

Running setup.py bdist_wheel for mysqlclient … error

Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-build-dpijq2lm/mysqlclient/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” bdist_wheel -d /tmp/tmp18kw5i1zpip-wheel- --python-tag cp36:

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,4,6,‘final’,0) -D__version__=1.4.6 -I/usr/include/mysql -I/usr/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o

MySQLdb/_mysql.c:38:20: fatal error: Python.h: No such file or directory

#include “Python.h”

^

compilation terminated.

error: command ‘gcc’ failed with exit status 1

二、解决方法

For apt (Ubuntu, Debian…):

sudo apt-get install python-dev # for python2.x installs

sudo apt-get install python3-dev # for python3.x installs

For yum (CentOS, RHEL…):

sudo yum install python-devel # for python2.x installs

sudo yum install python3-devel # for python3.x installs

For dnf (Fedora…):

sudo dnf install python2-devel # for python2.x installs

sudo dnf install python3-devel # for python3.x installs

For zypper (openSUSE…):

sudo zypper in python-devel # for python2.x installs

sudo zypper in python3-devel # for python3.x installs

For apk (Alpine…):

#This is a departure from the normal Alpine naming

#scheme, which uses py2- and py3- prefixes

sudo apk add python2-dev # for python2.x installs

sudo apk add python3-dev # for python3.x installs

For apt-cyg (Cygwin…):

apt-cyg install python-devel # for python2.x installs

apt-cyg install python3-devel # for python3.x installs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值