如何安装psutil以及提示缺少python.h头文件
下载psutil
下载地址https://pypi.python.org/packages/57/93/47a2e3befaf194ccc3d05ffbcba2cdcdd22a231100ef7e4cf63f085c900b/psutil-5.2.2.tar.gz#md5=bb98d48796cd76d9ccee871aad720f9c
解压
进入解压后的文件夹
安装
python setup.py install
我的会报错,解决方法是安装python-devel
过程如下
[root@localhost ~]# wget -c https://pypi.python.org/packages/57/93/47a2e3befaf194ccc3d05ffbcba2cdcdd22a231100ef7e4cf63f085c900b/psutil-5.2.2.tar.gz#md5=bb98d48796cd76d9ccee871aad720f9c
--2017-07-07 01:13:19-- https://pypi.python.org/packages/57/93/47a2e3befaf194ccc3d05ffbcba2cdcdd22a231100ef7e4cf63f085c900b/psutil-5.2.2.tar.gz
Resolving pypi.python.org (pypi.python.org)... 151.101.76.223, 2a04:4e42:12::223
Connecting to pypi.python.org (pypi.python.org)|151.101.76.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 348413 (340K) [binary/octet-stream]
Saving to: ‘psutil-5.2.2.tar.gz’
100%[======================================>] 348,413 1.43MB/s in 0.2s
2017-07-07 01:13:20 (1.43 MB/s) - ‘psutil-5.2.2.tar.gz’ saved [348413/348413]
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg psutil-5.2.2.tar.gz
a.sh original-ks.cfg
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg psutil-5.2.2.tar.gz
a.sh original-ks.cfg
[root@localhost ~]# tar zxf psutil-5.2.2.tar.gz
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg psutil-5.2.2
a.sh original-ks.cfg psutil-5.2.2.tar.gz
[root@localhost ~]# cd psutil-5.2.2/
[root@localhost psutil-5.2.2]# dir
CREDITS HISTORY.rst LICENSE MANIFEST.in psutil.egg-info setup.cfg
DEVGUIDE.rst IDEAS make.bat PKG-INFO README.rst setup.py
docs INSTALL.rst Makefile psutil scripts tox.ini
[root@localhost psutil-5.2.2]# python setup.py install
running install
running bdist_egg
running egg_info
writing psutil.egg-info/PKG-INFO
writing top-level names to psutil.egg-info/top_level.txt
writing dependency_links to psutil.egg-info/dependency_links.txt
reading manifest file 'psutil.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: manifest_maker: MANIFEST.in, line 14: 'recursive-include' expects <dir> <pattern1> <pattern2> ...
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no previously-included files matching '*' found under directory '.ci'
writing manifest file 'psutil.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil
creating 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_system.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
copying psutil/tests/test_misc.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_osx.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_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/runner.py -> 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_sunos.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=522 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o
psutil/_psutil_linux.c:12:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
[root@localhost psutil-5.2.2]# yum install python-devel -y
Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/2): extras/7/x86_64/primary_db | 188 kB 00:00
(2/2): updates/7/x86_64/primary_db | 7.7 MB 00:04
Determining fastest mirrors
* base: mirror.bit.edu.cn
* extras: mirrors.sohu.com
* updates: mirrors.sohu.com
Resolving Dependencies
--> Running transaction check
---> Package python-devel.x86_64 0:2.7.5-48.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
python-devel x86_64 2.7.5-48.el7 base 393 k
Transaction Summary
================================================================================
Install 1 Package
Total download size: 393 k
Installed size: 1.0 M
Downloading packages:
python-devel-2.7.5-48.el7.x86_64.rpm | 393 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-devel-2.7.5-48.el7.x86_64 1/1
Verifying : python-devel-2.7.5-48.el7.x86_64 1/1
Installed:
python-devel.x86_64 0:2.7.5-48.el7
Complete!
[root@localhost psutil-5.2.2]# python setup.py install
。。。。该部分内容太多省略,安装成功
重新进入python,导入psutil不再报错
[root@localhost ~]# python
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>>
如何安装psutil以及提示缺少python.h头文件的更多相关文章
- 安装psutil时提示缺少python.h头文件(作记录)
通过pip或者源码安装psutil,都会提示缺少python.h头文件,错误提示如下: ... psutil/_psutil_common.c:9:20: fatal error: Python.h: ...
- 提示缺少python.h解决办法
在安装uwsgi时,提示缺少python.h In file included :: plugins/python/uwsgi_python.h::: fatal error: Python.h: N ...
- Deepin下python安装uwsgi报错: Python.h:没有那个文件或目录
解决方法是安装python-dev,这是Python的头文件和静态库包 正在读取软件包列表... 完成正在分析软件包的依赖关系树 正在读取状态信息... 完成 下列软件包是自动 ...
- 【DirectX SDK Extra】提示缺少Qedit.h问题 (转)
原文转自 http://blog.csdn.net/joeblackzqq/article/details/10944005 DirectX 9.0 SDK 开发包以及扩展包下载(February 2 ...
- Loadrunner:安装LR11时提示缺少vc2005_sp1_with_atl_fix_redist
[问题现象] 安装LR11时提示缺少vc2005_sp1_with_atl_fix_redist: [解决办法] 手动安装缺少的组件,LR安装包中已自带该组件,为何不自动捕捉异常去获取该自带的组件去安 ...
- linux(kali,centos)安装vm及其提示缺少c头文件解决方法
我电脑系统是kali最新版 首先去官网下一个vm安装包,给个直达网址 http://www.vmware.com/cn/products/workstation/workstation-evaluat ...
- centos 在安装YouCompleteMe时提示 Fatal : pyconfig.h No such file or directory
问题:centos 在安装YouCompleteMe时提示 Fatal : pyconfig.h No such file or directory 解决:安装python-devel yum ins ...
- 找不到所需要的ndbm.h头文件
具体描述: 通过deb包安装gdbm之后,发现找不到所需要的ndbm.h头文件.但是你会发现一个叫gdbm-ndbm.h的文件,你只需要把文件名改成ndbm.h就可以了,当然需要一定权限. sudo ...
- VS2008和VC6.0下使用pthread.h头文件
原文:http://www.cppblog.com/liquidx/archive/2009/06/16/87811.html 要在windows环境下使用 #include <pthread. ...
随机推荐
- 稀疏 部分 Checkout
To easily select only the items you want for the checkout and force the resulting working copy to ke ...
- [Linux]Linux下修改snmp协议的默认161端口
一.Linux SNMP的配置 SNMP的简介和Linux下IPV4,IPV6地址的snmp协议开启可以参考上一个随笔:[Linux]CentOS6.9开启snmp支持IPV4和IPV6 二.修改默认 ...
- 将自己的域名解析跳转到博客主页(GitHub中的gitpage跳转)
最近突然迷上了博客,突然又突发奇想,将自己几个月前买的现在限制的域名拿来跳转到自己的csdn博客.经过一番研究,总结---- 把自己的购买的域名(比如我买的circleyuan.top)跳转到CSDN ...
- h5视频配置
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 安装ubuntu不能引导win7
台式机安装了ubuntu导致进不了win7了,2系统在同一硬盘. win7引导需要bootmgr和boot文件夹中的文件,2个东东在winows引导分区根目录下. 我的笔记本安装windows系统分区 ...
- Linux 虚拟内存机制
每个进程都有自己独立的4G内存空间,各个进程的内存空间具有类似的结构. Linux内存管理采用的是页式管理,使用的是多级页表,动态地址转换机构与主存.辅存共同实现虚拟内存 一个新进程建立的时候,将会建 ...
- Tap 模拟手势点击坐标
前言:有时候元素怎么都定位不到,没办法就只能坐标定位了,不过这个坐标定位不准确,换个手机就可能定位不到了,这是一个下下策的定位方式. tap用法 1.tap是模拟手指点击页面上元素语法有两个参数,第一 ...
- MySQL:安装mysqld系统及基础应用
MySQL篇 第一章.安装mysqld系统及基础应用 一.安装 注意:mysql的标点符号只能是英文的标点符号. 1.设置配置文件. 文件格式:文本格式 文件位置:Mysql的主目录下 文件名称:my ...
- ob_get_contents 获取输出缓存内容
function _require($filename){ ob_start(); include $filename; $content = ob_get_contents(); ob_end_cl ...
- SQL语句报错,无法绑定由多个部分组成的标识符解决
无法绑定由多个部分组成的标识符, 表示在查询的时候使用了别名,并且查询的多个表中存在相同的字段,如果在使用该字段时不明确该字段的来源就会报这个错误. 举例: 我们有两张表,B1,B2,他们有一个共同的 ...