centos7 python2安装psutil
[root@internet geo_server]# pip install psutilDEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.Collecting psutil
Using cached psutil-5.7.3.tar.gz (465 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2gS0Bh/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2gS0Bh/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-xS1cva
cwd: /tmp/pip-install-2gS0Bh/psutil/
Complete output (5 lines):
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
error in psutil setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.[root@internet geo_server]# [root@internet geo_server]# pip install --upgrade setuptoolsDEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.Collecting setuptools
Downloading setuptools-44.1.1-py2.py3-none-any.whl (583 kB)
|████████████████████████████████| 583 kB 287 kB/s
Installing collected packages: setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 0.9.8
Uninstalling setuptools-0.9.8:
Successfully uninstalled setuptools-0.9.8
Successfully installed setuptools-44.1.1[root@internet geo_server]#[root@internet geo_server]# pip install psutil==5.7.3DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.Collecting psutil==5.7.3
Using cached psutil-5.7.3.tar.gz (465 kB)Using legacy 'setup.py install' for psutil, since package 'wheel' is not installed.
Installing collected packages: psutil
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-Ra96ci/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-Ra96ci/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-K2AJo1/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python2.7/psutil
cwd: /tmp/pip-install-Ra96ci/psutil/
Complete output (45 lines):
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/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil
creating build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_aix.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_testutils.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_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_memleaks.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_posix.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_misc.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/__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_linux.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/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/runner.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_SIZEOF_PID_T=4 -DPSUTIL_VERSION=573 -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
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-Ra96ci/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-Ra96ci/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-K2AJo1/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python2.7/psutil Check the logs for full command output.[root@internet geo_server]# [root@internet geo_server]# yum install python2-develLoaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package python-devel.x86_64 0:2.7.5-90.el7 will be installed
--> Processing Dependency: python(x86-64) = 2.7.5-90.el7 for package: python-devel-2.7.5-90.el7.x86_64
--> Processing Dependency: python2-rpm-macros > 3-30 for package: python-devel-2.7.5-90.el7.x86_64
--> Processing Dependency: python-rpm-macros > 3-30 for package: python-devel-2.7.5-90.el7.x86_64
--> Running transaction check
---> Package python.x86_64 0:2.7.5-89.el7 will be updated
---> Package python.x86_64 0:2.7.5-90.el7 will be an update
--> Processing Dependency: python-libs(x86-64) = 2.7.5-90.el7 for package: python-2.7.5-90.el7.x86_64
---> Package python-rpm-macros.noarch 0:3-34.el7 will be installed
--> Processing Dependency: python-srpm-macros for package: python-rpm-macros-3-34.el7.noarch
---> Package python2-rpm-macros.noarch 0:3-34.el7 will be installed
--> Running transaction check
---> Package python-libs.x86_64 0:2.7.5-89.el7 will be updated
---> Package python-libs.x86_64 0:2.7.5-90.el7 will be an update
---> Package python-srpm-macros.noarch 0:3-34.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved==============================================================================================================================================================================
Package Arch Version Repository Size==============================================================================================================================================================================Installing:
python-devel x86_64 2.7.5-90.el7 updates 399 k
Installing for dependencies:
python-rpm-macros noarch 3-34.el7 base 9.1 k
python-srpm-macros noarch 3-34.el7 base 8.8 k
python2-rpm-macros noarch 3-34.el7 base 8.1 k
Updating for dependencies:
python x86_64 2.7.5-90.el7 updates 96 k
python-libs x86_64 2.7.5-90.el7 updates 5.6 M
Transaction Summary==============================================================================================================================================================================Install 1 Package (+3 Dependent packages)Upgrade ( 2 Dependent packages)Total download size: 6.2 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.(1/6): python-2.7.5-90.el7.x86_64.rpm | 96 kB 00:00:00
(2/6): python-srpm-macros-3-34.el7.noarch.rpm | 8.8 kB 00:00:00
(3/6): python-rpm-macros-3-34.el7.noarch.rpm | 9.1 kB 00:00:00
(4/6): python2-rpm-macros-3-34.el7.noarch.rpm | 8.1 kB 00:00:00
(5/6): python-devel-2.7.5-90.el7.x86_64.rpm | 399 kB 00:00:00
(6/6): python-libs-2.7.5-90.el7.x86_64.rpm | 5.6 MB 00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 6.6 MB/s | 6.2 MB 00:00:00
Running transaction check
Running transaction testTransaction test succeeded
Running transaction
Updating : python-libs-2.7.5-90.el7.x86_64 1/8
Updating : python-2.7.5-90.el7.x86_64 2/8
Installing : python-srpm-macros-3-34.el7.noarch 3/8
Installing : python-rpm-macros-3-34.el7.noarch 4/8
Installing : python2-rpm-macros-3-34.el7.noarch 5/8
Installing : python-devel-2.7.5-90.el7.x86_64 6/8
Cleanup : python-2.7.5-89.el7.x86_64 7/8
Cleanup : python-libs-2.7.5-89.el7.x86_64 8/8
Verifying : python2-rpm-macros-3-34.el7.noarch 1/8
Verifying : python-libs-2.7.5-90.el7.x86_64 2/8
Verifying : python-devel-2.7.5-90.el7.x86_64 3/8
Verifying : python-2.7.5-90.el7.x86_64 4/8
Verifying : python-rpm-macros-3-34.el7.noarch 5/8
Verifying : python-srpm-macros-3-34.el7.noarch 6/8
Verifying : python-libs-2.7.5-89.el7.x86_64 7/8
Verifying : python-2.7.5-89.el7.x86_64 8/8
Installed:
python-devel.x86_64 0:2.7.5-90.el7
Dependency Installed:
python-rpm-macros.noarch 0:3-34.el7 python-srpm-macros.noarch 0:3-34.el7 python2-rpm-macros.noarch 0:3-34.el7
Dependency Updated:
python.x86_64 0:2.7.5-90.el7 python-libs.x86_64 0:2.7.5-90.el7
Complete![root@internet geo_server]# [root@internet geo_server]# pip install psutil==5.7.3DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.Collecting psutil==5.7.3
Using cached psutil-5.7.3.tar.gz (465 kB)Using legacy 'setup.py install' for psutil, since package 'wheel' is not installed.
Installing collected packages: psutil
Running setup.py install for psutil ... doneSuccessfully installed psutil-5.7.3[root@internet geo_server]#------------------------------------
yum install python-dev
centos安装 python-dev包提示No package python-dev available:
出现此问题的原因是python-dev的包在centos的yum中不叫python-dev,而是python-devel.
所以使用下面的命令即可安装python-dev:
yum install python-devel
原文