环境:
系统:Centos
python:V3.6.8
一直遇到psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
,在网上搜了很久,都没找到解决方案,我尝试过用豆瓣( http://pypi.douban.com/simple) 以及清华的源,但是都不行。
最后我在odoo的群里问,有位朋友回复说需要安装gcc,于是我先安装gcc
yum -y install gcc gcc-c++ kernel-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirror.sjtu.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Package gcc-4.8.5-44.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 0:4.8.5-44.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-44.el7 for package: gcc-c++-4.8.5-44.el7.x86_64
--> Processing Dependency: libstdc++ = 4.8.5-44.el7 for package: gcc-c++-4.8.5-44.el7.x86_64
---> Package kernel-devel.x86_64 0:3.10.0-1160.11.1.el7 will be installed
--> Running transaction check
---> Package libstdc++.x86_64 0:4.8.5-39.el7 will be updated
---> Package libstdc++.x86_64 0:4.8.5-44.el7 will be an update
---> Package libstdc++-devel.x86_64 0:4.8.5-39.el7 will be updated
--> Processing Dependency: libstdc++-devel = 4.8.5-39.el7 for package: libstdc++-static-4.8.5-39.el7.x86_64
---> Package libstdc++-devel.x86_64 0:4.8.5-44.el7 will be an update
--> Running transaction check
---> Package libstdc++-static.x86_64 0:4.8.5-39.el7 will be updated
---> Package libstdc++-static.x86_64 0:4.8.5-44.el7 will be an update
--> Finished Dependency Resolution
安装完成之后,我继续尝试安装psutil,
python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn psutil
仍然报刚才的错误。
最后,我感觉快走投无路的时候,网上查了一下有可能是python3-devel没有安装(博客地址),最后执行这个命令
su