Python has two well-known package management tools easy_install.py and PIP. In Python2.7 's installation package, easy_install.py is installed by default, and Pip requires us to install it manually.
Compile and install PIP management tool here: https://pypi.org/project/pip/#files
The current PIP version is pip-10.0.1, which supports python2.x and python3.x
1. Download the file and unzip it
TAR-XF pip-10.0. 1
2. View pip file contents
1 [[email protected] pip-10.0. 1]# ls2AUTHORS.txt Dist LICENSE.txt news.rst pyproject.toml Setup.cfg src3 build docs MANIFEST. in pkg-INFO readme.rst setup.py
3. Install Pip
[Email protected] pip-10.0. 1] # python setup.py Install
4. View PIP Installation success version
1 [[email protected] pip-10.0. 1]# pip-V210.0. 1 from/usr/lib/python2. 7/site-packages/pip-10.0. 1-py2. 7 2.7)
5. Test and install Psutil module
[[Email protected] ~]# pip install Psutil
The following issues occur
1 collecting Psutil2Downloading https://files.pythonhosted.org/packages/51/9e/0f8f5423ce28c9109807024f7bdde776ed0b1161de20b408875de7e030c3/ Psutil-5.4.6.tar.gz (418kB)3 -% |████████████████████████████████| 419kB 227kb/s4Ipaclient4.5.4Requires JINJA2, which isNot installed.5Rtslib-fb2.1. thehas requirement pyudev>=0.16.1, but you'll has pyudev 0.15 which is incompatible.6Ipapython4.5.4has requirement dnspython>=1.15, but you'll has Dnspython 1.12.0 which is incompatible.7 Installing collected Packages:psutil8Running setup.py Install forpsutil ... error9Complete output fromCommand/bin/python-u-C"import setuptools, tokenize;__file__= '/tmp/pip-install-bo0yvs/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-fbepxr/install-record.txt--single-version-externally-managed--Compile:Ten/usr/lib64/python2.7/distutils/dist.py:267: Userwarning:unknown distribution option:'Python_requires' One Warnings.warn (msg) A Running Install - Running Build - running Build_py the Creating Build -Creating build/lib.linux-x86_64-2.7 -Creating build/lib.linux-x86_64-2.7/Psutil -Copying psutil/_exceptions.py-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/_psaix.py-build/lib.linux-x86_64-2.7/Psutil ACopying psutil/_pssunos.py-build/lib.linux-x86_64-2.7/Psutil atCopying 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 inCreating build/lib.linux-x86_64-2.7/psutil/tests -Copying psutil/tests/__main__.py-build/lib.linux-x86_64-2.7/psutil/tests toCopying psutil/tests/test_bsd.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_aix.py-build/lib.linux-x86_64-2.7/psutil/tests theCopying 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_system.py-build/lib.linux-x86_64-2.7/psutil/testsPanax NotoginsengCopying 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 theCopying 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 ACopying psutil/tests/test_process.py-build/lib.linux-x86_64-2.7/psutil/tests theCopying psutil/tests/test_windows.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 $Copying psutil/tests/test_unicode.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 theCreating 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=546-dpsutil_linux=1-i/usr/include/python2.7-C Psutil/_psutil_common.c-o build/temp.linux-x86_64-2.7/psutil/_PSUTIL_COMMON.OWuyi psutil/_psutil_common.c:9:20: Fatal error: Python.h: No file or directory the #include <Python.h> -^ Wu compile interrupts. - error:command ' gcc ' failed with exit status 1 About $---------------------------------------- -Command"/bin/python-u-C"Import Setuptools, tokenize;__file__='/tmp/pip-install-bo0yvs/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-fbepxr/install-record.txt--single-version-externally-managed--compile"Failed with error code1 inch/tmp/pip-install-bo0yvs/psutil/
Workaround:
Install Python-devel, which is the Python header file and the static library package
[email protected] ~]# Yum install Python-devel
6. Install the Psutil module again
1[[Email protected] ~]# pip Install psutil2 collecting Psutil3Using Cached https://files.pythonhosted.org/packages/51/9e/0f8f5423ce28c9109807024f7bdde776ed0b1161de20b408875de7e030c3/ Psutil-5.4.6.tar.gz4Ipaclient4.5.4Requires JINJA2, which isNot installed.5Rtslib-fb2.1. thehas requirement pyudev>=0.16.1, but you'll has pyudev 0.15 which is incompatible.6Ipapython4.5.4has requirement dnspython>=1.15, but you'll has Dnspython 1.12.0 which is incompatible.7 Installing collected Packages:psutil8Running setup.py Install forpsutil ... done9Successfully installed psutil-5.4.6
To this, PIP installation is successful, you can install the module you want to solve the dependencies of the module.
The PIP management tool for Python