Install pip in Centos offline environment

Description of the problem :
The server environment used by the project is Centos, and the Python version is 2.7.5. Install pip according to the method in the blog , and successfully installed version 8.1.2 of pip. However, this version of pip cannot install numpy and other modules. It prompts to upgrade pip through "pip install --upgrade pip", but executes "pip install --upgrade pip" and reports an error again, and still prompts "pip install --upgrade pip" to upgrade pip. Then fell into an endless loop. In a rage, I can only install the new version of pip offline.

Operation steps :

  1. Download the installation packages ending in tar.gz for setuptools and pip . It should be noted that pip 20.3 is the last version that supports python 2 , so you need to select the appropriate pip version installation package according to the python version.
  2. Open the /usr/lib/python2.7/site-packages directory, and upload the downloaded setuptools installation package and pip installation package to this directory, as follows:

insert image description here
rz is the command to upload files. After input, a window will pop up to select the uploaded file.

  1. Unzip and install setuptools and pip, the commands are as follows (take setuptools-9.1.tar.gz and pip-19.3.1.tar.gz as examples):
  • Unzip and install setuptools. Execute the following commands in sequence:

insert image description here
insert image description here
insert image description here

  • Unzip and install pip. Execute the following commands in sequence:

insert image description here

insert image description here

insert image description here

Reference

[1]: https://blog.csdn.net/weixin_45189629/article/details/107356924

Guess you like

Origin blog.csdn.net/Graduate2015/article/details/122352246