Python PIP


Introduction


PIP (Python Package Index) is a package management system used to install and manage software packages written in Python.

It simplifies the process of installing and managing dependencies for Python projects.

Check PIP version

For most modern distributions of Python 3, PIP comes pre-installed. You can check if it's installed by opening a command prompt (or terminal on macOS/Linux) and typing:

pip --version

If PIP is installed, it will display the version number. If not, you may need to install it manually.

PIP Version Check

Install PIP

For Windows

To install pip on Windows, download and install from https://pypi.org/project/pip/

For macOS/Linux

  • Use the following command in your terminal:
  • sudo apt-get install python3-pip
  • Then, install PIP using Python:
  • python3 -m pip install --upgrade pip

Using pip

  • Installing a Package:
  • pip install package_name
    Installing a Package
  • Installing a Specific Version of a Package:
  • pip install package_name==version_number
    Installing a Specific Version
  • Upgrading a Package:
  • pip install --upgrade package_name
    Upgrading a Package
  • Uninstalling a Package:
  • pip uninstall package_name
    Uninstalling a Package
  • Listing Installed Packages:
  • pip list
    Listing Installed Packages
  • Installing Packages from a requirements.txt File:
  • pip install -r requirements.txt
    Installing Packages from requirements.txt