ToolStack
KO

pip Commands Cheatsheet

Python package installation, requirements.txt, and venv basics

Your data never leaves the browser — all processing is done locally 0 server requests

01

Basic Installation & Removal

  • pip install 패키지명

    Install a package

  • pip install 패키지명==1.2.3

    Install a specific version of a package

  • pip install "패키지명>=2.0,<3.0"

    Install a package within a version range

  • pip install 패키지명 --upgrade

    Upgrade a package to the latest version

  • pip install 패키지명 --pre

    Install including beta and RC pre-releases

  • pip uninstall 패키지명

    Uninstall a package

  • pip uninstall -y 패키지명

    Uninstall without a confirmation prompt

02

Using requirements Files

  • pip install -r requirements.txt

    Install all packages listed in requirements.txt

  • pip freeze > requirements.txt

    Save the current environment's package list to a file

  • pip freeze | grep -v "^-e" > requirements.txt

    Save package list excluding editable (-e) packages

03

Package Listing, Search & Info

  • pip list

    Show installed packages and their versions

  • pip list --outdated

    Show packages that have newer versions available

  • pip show 패키지명

    Show a package's version, location, and dependencies

  • pip search 패키지명

    Search PyPI for a package (deprecated; use pypi.org directly)

04

Managing pip Itself

  • pip --version

    Check the pip version

  • pip install --upgrade pip

    Upgrade pip itself to the latest version

  • python -m pip install --upgrade pip

    Upgrade pip using the recommended method

05

Cache, Download & Source Installation

  • pip install --no-cache-dir 패키지명

    Install a package without using the cache

  • pip cache purge

    Delete all local pip cache files

  • pip download 패키지명 -d ./wheels

    Download a package as a .whl file without installing (for offline use)

  • pip install 패키지.whl

    Install directly from a local .whl file

  • pip install -e .

    Install the current directory package in editable (development) mode

  • pip install git+https://github.com/user/repo.git

    Install directly from a GitHub repository

06

Using with Virtual Environments (venv)

How to use pip with the standard Python venv (not conda)

  • python -m venv .venv

    Create a .venv virtual environment in the current directory

  • source .venv/bin/activate

    Activate the virtual environment (Linux/macOS)

  • .venv\Scripts\activate

    Activate the virtual environment (Windows CMD)

  • deactivate

    Deactivate the virtual environment

pip: Always Use a Virtual Environment

pip is Python's official package manager. Installing into the system Python directly can break other projects. The recommended workflow: python -m venv .venv → source .venv/bin/activate → pip install. Keep a requirements.txt at the project root for reproducible installs.

For production environments requiring strict version pinning, consider pip-compile from pip-tools. It resolves the full dependency tree and writes a locked requirements.txt, similar to package-lock.json in Node.js.

Run pip audit regularly to scan for known security vulnerabilities in your installed packages.

FAQ

What is the difference between pip install and pip install --upgrade?
pip install <package> does nothing if the package is already installed. Add --upgrade (-U) to fetch and install the latest version. Use pip list --outdated first to see which packages can be updated.
What is the difference between pip list and pip freeze?
pip list shows packages in a human-readable table. pip freeze outputs them in package==version format ready for requirements.txt. Use pip freeze > requirements.txt to capture your environment for sharing.
How do I install a package only for my user, not system-wide?
Use pip install --user <package> to install in your home directory without touching the system Python. However, using a virtual environment (venv or conda) is the recommended approach — it is cleaner and avoids polluting global state.

Related Tools