解决Python.h找不到问题

在linux系统上安装python的MySQLdb库时,提示

pip install MySQL
_mysql.c:29:20: fatal error: Python.h: No such file or directory
   #include "Python.h"
                      ^
  compilation terminated.
  error: command ‘gcc‘ failed with exit status 1

找不到Python.h,这是因为没有安装python-dev

使用yum search python |grep devel

找到了可用版本

python-devel.x86_64 : The libraries and header files needed for Python
                    : development

执行

yum  install python-devel.x86_64

进行安装

安装成功之后,Python.h出现了

/usr/include/python2.7/Python.h

再安装MySQL就成功了

时间: 2024-08-07 08:40:35

解决Python.h找不到问题的相关文章

解决 Python.h:没有那个文件或目录 错误的方法

http://www.cnblogs.com/yuxc/archive/2012/05/13/2498019.html ———————————————————————————————————————————————————————— 今天在实验室的ubuntu机子上安装Eventlet,在安装依赖包greenlet时出现错误,出现编译错误. 错误如下: In file included from greenlet.c:5:0: greenlet.h:8:20: 致命错误: Python.h:没有

TTPRequest 提示#import <libxml/HTMLparser.h>找不到 的解决方法

本文永久地址为http://www.cnblogs.com/ChenYilong/p/3984251.html ,转载请注明出处. ASIHTTPRequest 或者AFNetwork提示的#import <libxml/HTMLparser.h>找不到 使用ASIHTTPRequest 提示#import <libxml/HTMLparser.h>找不到 首先添加libxml2框架进来,但是继续报错, 然后 ?在header search path 加入 ${SDK_DIR}/u

Ubuntu下 fatal error: Python.h: No such file or directory 解决方法

参考: fatal error: Python.h: No such file or directory Ubuntu下 fatal error: Python.h: No such file or directory 解决方法 根据使用的Python版本安装python-dev库. sudo apt-get install python-dev # for python2.x installs sudo apt-get install python3-dev # for python3.x i

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

[常见错误] fatal error: Python.h: No such file or directory 环境场景 系统: Parrot Linux软件: 系统python默认版本2.7 PyCharm默认版本Python3.5场景: Build pycrypto-2.6.1 失败提示: building 'Crypto.PublicKey._fastmath' extension x86_64-linux-gnu-gcc -pthread -fwrapv -Wall -Wstrict-p

_mysql.c:29:20: error: Python.h: No such file or directory

在Centos系统中安装 pip install MySQL-python 提示: _mysql.c:29:20: error: Python.h: No such file or directory_mysql.c:40:26: error: structmember.h: No such file or directory 解决方法:yum install python-devel #yum install mysql-devel.x86_64 -----------------------

解决 Python UnicodeDecodeError

在使用django和flask时,发现加载css.js等静态文件时会因为UnicodeDecodeError而失败,在网上搜到了一篇文章,完美解决: 解决方案如下: 编辑Python27\Lib\mimetypes.py文件,全选,替换为以下patch后的正确脚本,或者直接依据此patch修改: """Guess the MIME type of a file.   This module defines two useful functions:   guess_type(

python能够执行,但编译第三包遇到 python.h no such file or directory

这个问题是由于没有安装python-devel, 安装此包就能够解决次问题,在Linux下就能够看到 /usr/include/python2.6/Python.h

paip.日志中文编码原理问题本质解决python

默认的python日志编码仅仅gbk...保存utf8字符错误..输出到个eric5的控制台十默认好像十unicode的,要是有没显示出来的字符,大概十字体问题..调整eric5的字体走ok兰. #调用封装 from log import * iniLog (r"c:\enPn2atiEnPh.log") logx("xxx") #主要的代码 设置文件编码为utf8 handler = logging.FileHandler(logfile, "a&quo

plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory

装一台新服务器环境的时候,装uwsgi报错: plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory #include <Python.h> 查了一下解决办法: yum install python-devel.x86_64   之后再运行安装,问题解决.