First, check the current version of the system Python
Python -V
pip -V
Second, install all the development tools package and dependent packages
yum groupinstall -y "Development tools”
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel
Third, download, compile and install Python
$ wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
$ tar zxf Python-2.7.5.tgz
$ cd Python-2.7.5
$ ./configure
$ make && make install
$ ll /usr/local/bin/py*
$ rm -f /usr/bin/python-config
$ ln -s /usr/local/bin/python /usr/bin/python
$ ln -s /usr/local/bin/python-config /usr/bin/python-config
$ ln -s /usr/local/include/python2.7/ /usr/include/python2.7
$ python -V
Python 2.7.5 # output with the corresponding version number indicates the version number of your installed properly
Fourth, the installation and setup tools pip
pip is the python installation tools, a lot of common tools python, can be installed by a pip.
To install pip, you must first install setuptools. Official website, https://pypi.python.org/pypi/setuptools
Note that the downloadable version can not be too new (test version is available via the following)
Download setuptools (wget may not download, use the browser to download):
$ wget https://files.pythonhosted.org/packages/37/1b/b25507861991beeade31473868463dad0e58b1978c209de27384ae541b0b/setuptools-40.6.3.zip
$ unzip setuptools-40.6.3.zip
$ cd setuptools-40.6.3
$ python setup.py install
Setuptools properly after installation is complete, easy_install command will be installed in / usr / local / bin directory, you can use the command "which easy_install" to view.
After installation is complete, download pip. The following information in its website: https://pypi.python.org/pypi/pip
Download pip-19.1.1:
wget https://files.pythonhosted.org/packages/93/ab/f86b61bef7ab14909bd7ec3cd2178feb0a1c86d451bc9bccd5a1aedcde5f/pip-19.1.1.tar.gz --no-check-certificate
Similarly, the installation
tar vxf pip-9.0.1.tar.gz
cd pip-9.0.1
python setup.py install
After the installation is complete, run pip
[root@hwthstest08 pip-8.1.1]# pip
Usage:
pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion
help Show help for commands.
....
A detector installation procedure:
[root@hwthstest08 pip-8.1.1]# pip install psutil
If you fail, the version number of the version number may be wrong, modify / usr / bin / pip in
#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==9.0.1','console_scripts','pip'
__requires__ = 'pip==9.0.1'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
)