一、描述

在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

注意:本文归作者所有,未经作者允许,不得转载

python mysql python.h_MySQLdb/_mysql.c:38:20: fatal error: Python.h: No such file or directory相关推荐

  1. decode.c:38:18: fatal error: dnet.h: No such file or directory

    根据文档(Snort 2.9.7.x on Ubuntu 12 LTS and 14 LTS)为snort安装barnyard2的时候遇到问题: 缺少dnet.h头文件 decode.c:38:18: ...

  2. /usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or dir

    caffe编译报错: /usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such ...

  3. uwsgi 安装报错 plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory

    1. Python3 安装 uwsgi 报错 直接使用命令 sudo pip3 install uwsgi 安装如下错误: ubuntu@ubuntu:~/Downloads$ sudo pip3 i ...

  4. CentOS7安装twisted报错: src/twisted/test/raiser.c:4:20: fatal error: Python.h : No such file or direc

    问题: CentOS7安装twisted报错: src/twisted/test/raiser.c:4:20: fatal error: Python.h : No such file or dire ...

  5. ubuntu 安装scrapy error :wisted/test/raiser.c:4:20: fatal error: Python.h: No such file or directory

    wisted/test/raiser.c:4:20: fatal error: Python.h: No such file or directocompilation terminated.erro ...

  6. fatal error: Python.h: No such file or directory 解决

    [常见错误] fatal error: Python.h: No such file or directory 环境场景 系统: Parrot Linux 软件: 系统python默认版本2.7 Py ...

  7. Python.h: No such file or directory

    安装python-devel包解决这个问题 # pip install netifaces     DEPRECATION: Python 2.6 is no longer supported by ...

  8. [常见错误]Python.h: No such file or directory

    这个错误是通过source code安装PyGeSQL时遇到的 [root@centos6u2 PyGreSQL-4.0]# python setup.py build running build r ...

  9. python multiprocessing manager list error: [Errno 2] No such file or directory

    python multiprocessing manager list error: [Errno 2] No such file or directory for i in range(AMOUNT ...

最新文章

  1. 天平游码读数例题_量筒、天平经典习题
  2. 【Swift】UITableViewCell 中 TTTAttributedLabel 超链接无法点击的问题
  3. Redis基础知识点总结
  4. 去除表单元素的默认样式
  5. centos7.8中源码编译安装redis
  6. 安卓逆向_14 --- 单机和弱联网游戏内购 突破口 和 思路
  7. python 函数内部声明全局变量
  8. GBDT和XGBoost
  9. Buffer(缓冲/字节容器)详解
  10. Nginx + tornado + supervisor部署
  11. 大型任务处理:为虚拟现实游戏施展混合现实魔法
  12. 积木机器人拼装图恐龙图纸_‎机器人积木模型--恐龙积木拼装对战游戏 v App Storu...
  13. Spark Architecture
  14. OpenCV-图像处理(11、形态学操作)
  15. Qt 信号和槽机制( 详解 )
  16. ifconfig 配置ip,netmask,gw
  17. 从0开始编写minecraft光影包(0)GLSL,坐标系,光影包结构介绍
  18. oracle查询dictionary,Oracle的DICTIONARY/DICT视图。
  19. #彻底解决# opencv imdecode函数中打开图片,图片变色的问题
  20. Metasploit 渗透测试02-安装和疑难解决

热门文章

  1. 牛客网编程题04--字符串处理
  2. Go语言学习Day05
  3. KVM-Arch-Figure
  4. Linux用户空间与内核空间(理解高端内存)
  5. python搭配什么数据库_教你如何优雅地用Python连接MySQL数据库
  6. 单片机modbus rtu通讯_【原创】永宏PLC系列RS485通讯方式
  7. mysql数据库查询的传统句子
  8. ubuntu怎么看python版本_Ubuntu下Python版本更新问题
  9. python万年历_python万年历
  10. mysql建立作业_mysql创建作业及问题解决