Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommended way to install pip(3) on centos7

I am interrested in knowing the recommended way to install pip3 for python3.6 (as of today, may 2018) on current version of centos7 (7.5.1804) and the accepted answer of How to install pip in CentOS 7? seems to be outdated because:

yum search -v pip 

outputs (among other things):

python2-pip.noarch : A tool for installing and managing Python 2 packages Repo        : epel  python34-pip.noarch : A tool for installing and managing Python3 packages Repo        : epel 

and python34-pip seems to be a (newer?) simpler way than the accepted answer of How to install pip in CentOS 7? :

sudo yum install python34-setuptools

sudo easy_install-3.4 pip

But since the versions of python installed on my machine are 2.7.5 and 3.6.3 why is it python34-pip and not python36-pip ? Is pip the same for 3.4+ (up to current 3.6.3) ?

like image 724
shrimpdrake Avatar asked May 18 '18 10:05

shrimpdrake


People also ask

What is the best way to install pip?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process.

How do I get PIP3 on Linux?

To install pip3 on Ubuntu or Debian Linux, open a new Terminal window and enter sudo apt-get install python3-pip . To install pip3 on Fedora Linux, enter sudo yum install python3-pip into a Terminal window. You will need to enter the administrator password for your computer in order to install this software.


1 Answers

  1. Is pip the same for 3.4+

    No, it's not. A single pip installation serves a single Python distribution (pip2.7/pip3.4/pip3.5 etc).

  2. Since Python 3.5, pip is already bundled with the python distribution, so you can just run python3.6 -m pip instead of pip.

  3. Python 3.6 is not available in CentOS 7 vanilla repo. I usually resort to IUS repo when needing to install a fresh Python on CentOS. It always has the most recent Python version, the current one being 3.6.5. It also offers a correspondent pip package.

    $ yum install https://centos7.iuscommunity.org/ius-release.rpm $ yum install python36u python36u-devel python36u-pip 

    Unfortunately, IUS doesn't offer a package for Python 3.7 yet so if you are looking for Python 3.7 on CentOS 7, building from source is your only option.

Edit: when yum is not an option

You should prefer the bootstrapping solution described in this answer as it is the most reliable way to get a working pip installed.

like image 146
hoefling Avatar answered Sep 23 '22 12:09

hoefling