Recherche de site Web

Installation de PIP, l’outil d’empaquetage Python sur RHEL 7 Linux


Afin d’installer PIP, l’outil d’empaquetage Python sur RHEL 7 Linux, nous devons d’abord installer son seul pré-requis et c’est-à-dire le package setuptools, sinon nous obtiendrons un message d’erreur suivant :


Downloading/unpacking pip
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement pip
Cleaning up...
No distributions at all found for pip
Storing debug log for failure in /root/.pip/pip.log

Pour cette raison, nous installons d’abord setuptools :


[root@rhel7 ~]# wget https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz --no-check-certificate
[root@rhel7 ~]# tar xzf setuptools-7.0.tar.gz
[root@rhel7 ~]# cd setuptools-7.0
[root@rhel7 ~]# python setup.py install
...
Installed /usr/lib/python2.7/site-packages/setuptools-7.0-py2.7.egg
Processing dependencies for setuptools==7.0
Finished processing dependencies for setuptools==7.0

Une fois le paquet setuptools installé, nous pouvons maintenant procéder à l’installation de PIP. Ici, nous supposons que python est déjà installé sur votre système Linux Redhat 7.


[root@rhel7 ~]# wget https://bootstrap.pypa.io/get-pip.py
[root@rhel7 ~]# python get-pip.py
Downloading/unpacking pip
  Downloading pip-1.5.6-py2.py3-none-any.whl (1.0MB): 1.0MB downloaded
Installing collected packages: pip
Successfully installed pip
Cleaning up...

C’est fait. Confirmons nos actions en vérifiant la version de PIP :


[root@rhel7 ~]# pip --version
pip 1.5.6 from /usr/lib/python2.7/site-packages (python 2.7)

{loadposition python-tutorial-toc}

Articles connexes: