出现command 'gcc' failed with exit status 1 解决方案
来源:互联网 发布:centos 鼠标失效 编辑:程序博客网 时间:2024/05/24 01:41
在centos7 上用pip 安装psutil的时候很不幸的出现了如下错误
#pip install psutil
Collecting psutilUsing cached psutil-5.3.1.tar.gz
Installing collected packages: psutil
Running setup.py install for psutil ... error
Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-7cazf_/psutil/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-VA3Ckj-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil
creating build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/psutil
gcc -pthread -fno-strict-aliasing -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 -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 -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=531 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-7cazf_/psutil/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-VA3Ckj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-7cazf_/psutil/
经过寻找,找到如下解决方案,目测应该是缺少开发文件
#dnf install python2-devel
Using metadata from Mon Oct 9 22:19:37 2017
Dependencies resolved.
===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
python-devel x86_64 2.7.5-58.el7 base 395 k
Removing:
python x86_64 2.7.5-48.el7 @System 79 k
Transaction Summary
===============================================================================================
Install 1 Package
Remove 1 Package
Total download size: 395 k
Is this ok [y/N]: y
Downloading Packages:
python-devel-2.7.5-58.el7.x86_64.rpm 2.4 MB/s | 395 kB 00:00
-----------------------------------------------------------------------------------------------
Total 1.9 MB/s | 395 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Installing : python-devel-2.7.5-58.el7.x86_64 1/2
Erasing : python-2.7.5-48.el7.x86_64 2/2
Verifying : python-devel-2.7.5-58.el7.x86_64 1/2
Verifying : python-2.7.5-48.el7.x86_64 2/2
Removed:
python.x86_64 2.7.5-48.el7
Installed:
python-devel.x86_64 2.7.5-58.el7
Complete!
重新安装psutil,顺利解决
#pip install psutil
Collecting psutil
Using cached psutil-5.3.1.tar.gz
Installing collected packages: psutil
Running setup.py install for psutil ... done
Successfully installed psutil-5.3.1
- 出现command 'gcc' failed with exit status 1 解决方案
- CentOs安装Scrapy出现error: Setup script exited with error: command ‘gcc’ failed with exit status 1错误解决方案
- CentOs安装Scrapy出现error: Setup script exited with error: command ‘gcc’ failed with exit status 1错误解决方案
- [Python]安装PIL出现command 'gcc' failed with exit status 1错误
- centos6.6下安装MySQLdb时出现“error: command 'gcc' failed with exit status 1”
- 关于Python安装模块出现error: command 'gcc' failed with exit status 1错误的解决方法
- error: command 'gcc' failed with exit status 1
- error: command 'gcc' failed with exit status 1
- error: command 'gcc' failed with exit status 1
- error: command 'gcc' failed with exit status 1 解决方法
- error: command 'gcc' failed with exit status 1 的解决办法
- 【centos】 error: command 'gcc' failed with exit status 1
- error: command 'gcc' failed with exit status 1
- error: command 'gcc' failed with exit status 1
- error: command 'gcc' failed with exit status 1 的解决办法
- centos---error: command 'gcc' failed with exit status 1
- error: command ‘gcc’ failed with exit status 1
- error: command 'gcc' failed with exit status 1
- Android 程序工程的高内聚,低耦合
- web页面延迟3秒跳转
- 不将就的Python书单
- 异常值的探测(R)
- 简单的javascript的应用
- 出现command 'gcc' failed with exit status 1 解决方案
- d3 经典版本
- 实现句子的反转
- 基带丢失、IMEI丢失、手机无信号--高通通用解决办法
- .Net Mvc View页面引擎Razor使用笔记-持续更新
- Java设计模式-单例模式
- 资源限定符
- 电量低于15% 闪光灯仍会正常打闪
- Python:类的继承