Python PIP

A package is a piece of software that provides particular features while programming. A package contains all the resources which a module requires. Modules are sets of Python code that we can add to our project. Python pip is the package manager for Python packages. pip comes pre-installed on 3.4 or older versions of Python, pip commands are used in the command prompt.
The basic syntax of pip commands in command prompt is:

pip 'arguments'

Some of the most commonly used pip commands are:

  • Check pip version: We can check the pip version in our system by using the below command.

    Syntax:

    pip --version
    

    Example:

  • Install packages: We can install additional packages by using the below command.

    Syntax:



    <pip install numpy
    

    Example 1: When the required package is not installed.

    Example 2: When the required package is already installed.

    We can also install the package of a specific version.

    Syntax:

    pip install package_name==version
    
  • Display package information: We can use the below command to display the details of a particular package.

    Syntax:

    pip show numpy
    

    Example:

  • List installed packages: The below command displays a list of packages installed in the system.

    Syntax:

    pip list
    

    Example:

  • Uninstall packages: The below command uninstall a particular existing package.

    Syntax:

    pip uninstall numpy
    

    Example:

  • Search packages: We can search for a particular existing package using pip.

    Syntax:

    pip search numpy
    

    Example:

  • Using requirement files: Checks if a required package is present in the system, if not then they are installed. Suppose requirements.txt has the below contents:

    Syntax:

    pip install -r requirements.txt
    

    Example:

  • Listing additional packages: The freeze command is used to list packages that don’t come pre-installed with Python.

    Syntax:

    pip freeze
    

    Example:

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.