In Python versions 2.7.9+ and 3.4+, pip is included in the Python installation package. For these versions, you can directly use the pip command.
However, here’s the catch: the version of Python installed via yum
on CentOS does not include pip. This means that running a command like yum install python3.11
will install Python but will not include pip. Hence, the necessity for the following instructions!
If you are using an older version of Python, or if you need to upgrade pip to the latest version, you will need to install pip manually. Here’s how to install pip:
-
Download the
get-pip.py
script: First, you need to download theget-pip.py
script from the official website https://bootstrap.pypa.io/get-pip.py. You can use your browser to access this URL and save the script to a directory on your computer. -
Open Terminal or Command Prompt: Open your terminal or command prompt and navigate to the directory where the
get-pip.py
file is located. -
Run the
get-pip.py
script: In the terminal or command prompt, execute the following command:1
$ python get-pip.py
If you have both Python 2 and Python 3 installed, use the following command to run
get-pip.py
:1
$ python3 get-pip.py
-
Check if pip is installed correctly: Use the following command to verify if pip is installed correctly:
1
$ pip --version
If you receive version information about pip, it indicates that pip has been installed successfully.
That’s the entire process for installing pip. Please note that in some cases, you may need administrative privileges to install pip.