[Linux] install pip (detailed tutorial)

insert image description here

foreword

Since there is no pip in the python that comes with the system, and we just need to use pip at this time, what should we do? Today I will teach you how to install pip in linux;

pip download

You can download any version; you can choose the second version whichever version you need, and just change the version you need;

#pip22.2.2 version 
wget https://files.pythonhosted.org/packages/4b/30/e15b806597e67057e07a5acdc135216ccbf76a5f1681a324533b61066b0b/pip-22.2.2.tar.gz

#pip1.5.4 version 
wget https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz

#pip9.0.1 version 
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

pip install

Let's do it with version 9.0.1

#Unzip the compressed package 
tar xf pip-9.0.1.tar.gz

#Enter the pip-9.0.1 directory 
cd pip-9.0.1

#Install 
python setup.py install
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

Found installation error

insert image description here

The reason is because: When installing pip, it is prompted to use the modules in setuptools in setup.py, but we did not install the setuptools package at the beginning, so we need to download and install the setuptools first!

Download/install setuptools

1. Download setuptools

#download setuptools 
wget https://pypi.python.org/packages/28/4f/889339f38da415e49cff15b21ab27becbf4c017c79fbfdeca663f5b33b36/setuptools-36.4.0.zip
  • 1
  • 2

2. Unzip the setuptools package

unzip setuptools-36.4.0.zip

cd setuptools-36.4.0
  • 1
  • 2
  • 3

3. Compile setuptools

python setup.py build
  • 1

4. Start the setuptools installation

python setup.py install
  • 1

Finished stands for success!

insert image description here

install pip again

Now that setuptools is installed, we enter the pip-9.0.1 directory again and install pip using the "python setup.py install" command:

cd pip-9.0.1

python setup.py install
  • 1
  • 2
  • 3

Finished stands for success!

insert image description here

Verify that the pip installation was successful

pip --version
  • 1

It can be found that the installation is successful, and then we can install the packages we want;

insert image description here

Test installing the required packages using the pip command

pip install nose
pip install virtualenv
pip install distribute
pip install runlike
  • 1
  • 2
  • 3
  • 4

insert image description here

Related Columns/Articles

Related column: "python basics"


Related article: Centos installs third-party modules required for python3/pip3 projects (online && offline)

insert image description here

Related: [Linux] install pip (detailed tutorial)