PIP is a package manager for Python, which allows you to install and manage additional libraries and dependencies that are not included in the standard Python library.
Why Use PIP?
PIP simplifies the process of installing and managing Python software packages. It is essential for accessing the vast ecosystem of Python packages available in the Python Package Index (PyPI).
How to Install PIP
If you are using Python 3.4+ or Python 2.7.9+, PIP comes pre-installed. If you need to install it manually, you can do so using the following command in your terminal:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py
Basic PIP Commands
Installing a Package
To install a package, use the command:
pip install package_name
For example, to install the requests
library:
pip install requests
Uninstalling a Package
To uninstall a package, use the command:
pip uninstall package_name
For example, to uninstall the requests
library:
pip uninstall requests
Listing Installed Packages
To see a list of all installed packages, use:
pip list
Searching for Packages
To search for a specific package in PyPI, use:
pip search package_name
Showing Package Information
To display detailed information about an installed package, use:
pip show package_name
Python PIP Example Usage
- Install a Package:
pip install numpy
- Uninstall a Package:
pip uninstall numpy
- List all Installed Packages:
pip list
- Search for a Package:
pip search pandas
- Show Package Information:
pip show pandas