HOME HTML EDITOR C JAVA PHP python

Python PIP

PIP is the standard package manager for Python. It lets you install, upgrade, list, and remove third-party libraries and packages hosted on PyPI (Python Package Index) right from your command line or terminal.

1. Checking PIP Version & Installing Packages

Verify that pip is installed and use pip install to download a package such as requests:

pip --version
pip install requests

2. Listing & Uninstalling Packages

View all installed packages in your environment with pip list, or remove a package with pip uninstall:

pip list
pip uninstall requests

3. Managing Dependencies with requirements.txt

Export your project dependencies into a requirements.txt file and install them on another machine with a single command:

# Save installed packages to requirements.txt
pip freeze > requirements.txt

# Install all packages listed in requirements.txt
pip install -r requirements.txt

4. Using PIP Inside a Virtual Environment

Best practice is to isolate project packages inside a virtual environment (venv) so different projects do not conflict:

python -m venv venv
# Activate on Windows: venv\Scripts\activate
# Activate on macOS/Linux: source venv/bin/activate
pip install flask
Tip: Running python -m pip install <package> ensures you install the package into the exact Python interpreter you are running.