-->

DEVOPSZONES

  • Recent blogs

    How to Install and upgrade PIP on CentOS 7

    How to Install and upgrade PIP on CentOS 7

    How to Install and upgrade PIP on CentOS 7
    How to Install and upgrade PIP on CentOS 7

    Pip is a package management system that simplifies installation and management of software packages written in Python such as those found in the Python Package Index (PyPI). Pip is not installed by default on CentOS 7, but the installation is pretty simple.

    In this tutorial, we will walk through the steps required to install Python pip on CentOS 7 using the yum package manager and cover the basics of how to install and manage Python packages with pip.

    you'll get this Error if "pip" is not installed :

    -bash: pip: command not found

    Unluckily, pip is not packaged in official software repositories of CentOS/RHEL. So you need to enable the EPEL repository and then install it like this.

    1. Add the EPEL Repository


    yum install epel-release

    2. Install pip

    yum install python-pip

    3. Verify Pip installation

    pip --version

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

    Install a package

    pip install
    [root@devserver ~]# pip install awscli
    Collecting awscli
      Downloading https://files.pythonhosted.org/packages/76/f4/63853217c2065cffaf84e7ca76d861509ee59c058959473f6b562cdda32f/awscli-1.16.265-py2.py3-none-any.whl (2.4MB)


    Uninstall a package

    pip uninstall  <package name>
    pip uninstall awscli

    Search packages

    pip search "<package name>"

    [root@devserver ~]# pip search "awscli"
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    awscli-cwlogs (1.4.6)                        - AWSCLI CloudWatch Logs plugin
    okta-awscli (0.4.1)                          - Provides a wrapper for Okta authentication to awscli
    awscli-bastion (0.8.3)                       - awscli-bastion extends the awscli by managing mfa protected short-lived credentials
                                                   for an aws bastion account.
    awscli-sqsall (1.0.1)                        - awscli pulgin to treat SQS queues more like files
    awscli (1.18.47)                             - Universal Command Line Environment for AWS.


    If you want to Test python Programs, you can check out this article.


    List Installed Packages

    pip list
    [root@devserver ~]# pip list
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    Package                          Version
    -------------------------------- -------
    ansible                          2.9.6
    awscli                           1.18.26
    Babel                            0.9.6
    backports.ssl-match-hostname     3.5.0.1
    botocore                         1.15.26


    Upgrade PIP


    pip install --upgrade pip
      root@exampleserver ~]# pip install --upgrade pip
    Collecting pip
      Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
        100% |████████████████████████████████| 1.4MB 739kB/s
    Installing collected packages: pip
      Found existing installation: pip 8.1.2
        Uninstalling pip-8.1.2:
          Successfully uninstalled pip-8.1.2
    Successfully installed pip-20.0.2
    [root@exampleserver ~]#

    No comments