安装Python的psutil模块时报错:error: command 'gcc' failed with exit status 1

安装Python的psutil模块:

tar zxvf psutil-2.0.0.tar.gz
cd psutil-2.0.0
python setup.py install

报错:

running install
running bdist_egg
......
psutil/_psutil_linux.c:12:20: error: Python.h: No such file or directory
In file included from psutil/_psutil_linux.c:23:
psutil/_psutil_linux.h:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
......
psutil/_psutil_linux.h:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c: In function ‘ioprio_get’:
psutil/_psutil_linux.c:50: warning: implicit declaration of function ‘syscall’
psutil/_psutil_linux.c: At top level:
psutil/_psutil_linux.c:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
......
psutil/_psutil_linux.c:384: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PsutilMethods’
psutil/_psutil_linux.c:421: error: expected specifier-qualifier-list before ‘PyObject’
psutil/_psutil_linux.c: In function ‘init_psutil_linux’:
psutil/_psutil_linux.c:470: error: ‘PyObject’ undeclared (first use in this function)
psutil/_psutil_linux.c:470: error: (Each undeclared identifier is reported only once
psutil/_psutil_linux.c:470: error: for each function it appears in.)
psutil/_psutil_linux.c:470: error: ‘module’ undeclared (first use in this function)
psutil/_psutil_linux.c:470: warning: implicit declaration of function ‘Py_InitModule’
psutil/_psutil_linux.c:470: error: ‘PsutilMethods’ undeclared (first use in this function)
error: command ‘gcc‘ failed with exit status 1

原因:

gcc包已装,缺少python-devel包

解决:

yum install python-devel -y

安装Python的psutil模块时报错:error: command 'gcc' failed with exit status 1

时间: 2024-10-27 13:13:39

安装Python的psutil模块时报错:error: command 'gcc' failed with exit status 1的相关文章

安装python模块报错 error: command 'gcc' failed with exit status 1

最近在安装paramiko模块的时候,总是报错:error: command 'gcc' failed with exit status 1,一开始比较挠头.找了蛮多资料,说的大多都是说缺少Python-devel 包,然而并不是! 最后蛮费劲的找到了一遍短小但就是正确的博文:http://blog.csdn.net/fenglifeng1987/article/details/38057193 —————————————————————— 解决方法: 安装:yum install gcc li

python安装模块的时候报错error: command 'gcc' failed with exit status 1

[情况] 在写Python代码的时候,需要用到psutil模块,需要安装. 但是在安装时,报错:error: command 'gcc' failed with exit status 1 [解决步骤] 按照经验,觉得应该是缺少了gcc模块, 所以操作 [ yum install -y gcc ] 安装完成后,再继续安装psutil还是报同样的错,发现报错不是  not found gcc,可能是某个功能模块缺失 发现需要安装多一些依赖的包:  [ yum install -y libffi-d

安装MySQL-python报错error: command 'gcc' failed with exit status 1

[[email protected] MySQL-python-1.2.3]# python setup.py install function) .... _mysql.c:133: error: 'ER_SYNTAX_ERROR' undeclared (first use in this function) _mysql.c:380: error: '_mysql_ConnectionObject' has no member named 'connection' _mysql.c:382

python爬虫问题:error: command 'gcc' failed with exit status 1

软件安装过程中,在安装lxml的时候出现如下错误 error: command 'gcc' failed with exit status 1 gcc当然没问题,问题原因是缺少相关组件, 安装以下2个组件即可, yum install libxslt-devel libxml2-devel 回到lxml-3.4.2目录,执行 python setup.py install 安装成功! python爬虫问题:error: command 'gcc' failed with exit status

Centos4.3安装MySQL-python-1.2.3,出现error: command 'gcc' failed with exit status 1

在Linux Centos 4.3上安装MySQL-python-1.2.3的时候出现error: command 'gcc' failed with exit status 1, 具体原因是因为没有安装mysql-devel包 使用yum install mysql-devel成功解决. 才想起来在运行python setup.py build 的时候先报一个错误,是因为没有安装setuptools. 得先安装一个setuptools-0.6c11就好了.具体步骤如下: 需要的软件包:setu

error: command ‘gcc’ failed with exit status 1的解决方法

源码安装完sqlite3,再安装pysqlite-2.6.3.tar.gz出现error: command 'gcc' failed with exit status 1.安装其他软件时,这个错误出现的频率也很高.通过修改源码的.cfg文件问题可以解决,原因是cfg文件里的路径默认设置在/usr/local下,所以把cfg文件里的/usr/local路径改成包的路径就ok啦.或者把安装包放到/usr/local下也行. vim setup.cfg: [build_ext] #define= in

安装cx_Oracle时报错:error: command 'gcc' failed with exit status 1

1.安装cx_Oracle 1)下载cx_Oracle,https://pypi.python.org/pypi 2)解压压缩包 3)执行python setup.py install 执行后报错:error: command 'gcc' failed with exit status 1 排查: 1)检查是否安装oracle客户端软件 2)查看当前环境变量中是否配置oracle的相关变量,如echo $ORACLE_HOME 3)如果没有配置需要将oracle环境变量配置到当前用户.bash_

centos7 安装mysql--python模块出现EnvironmentError: mysql_config not found和error: command 'gcc' failed with exit status 1

要想使python可以操作mysql 就需要MySQL-python驱动,它是python 操作mysql必不可少的模块. 下载地址:https://pypi.python.org/pypi/MySQL-python/ 下载MySQL-python-1.2.5.zip 文件之后直接解压.进入MySQL-python-1.2.5目录: python setup.py install 报错: [[email protected] MySQL-python-1.2.4]# python setup.p

词云:解决pip install wordcloud安装过程中报错“error: command 'x86_64-linux-gnu-gcc' failed with exit status 1”问题

外部环境:ubuntu16.04, 64bits, 全局环境python2.7 在虚拟环境(python3.5)中执行 pip install wordcloud 时安装失败,报错: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for wordcloud Running setup.py