PIP
Overview of the Standard Python Package Manager, PIP.
Introduction
The standard Python package manager is pip. It is ideal for quickly starting Python projects, like simple scripts or small projects with few dependencies. While capable of handling larger projects, tools like poetry are ideal for larger projects with complex dependencies.
The following notes assume:
Python 3
MacOS
An alias in
bashprofile to mappythontopython3.
Setup
The following is a step-by-step process for setting up a virtual environment in my-project and installing dependencies in it with pip.
cdinto your project directory.
cd my-projectCreate the virtual environment named
env.
python -m venv envActivate the virtual environment.
source env/bin/activateInstall dependencies.
pip install <PACKAGE_NAME>Commands
The following is a list of common commands used when managing a project with pip.
Activate Virtual Environment
Deactivate Virtual Environment
Uninstall a Package
List Installed Packages
Create a requirements.txt File
Install Packages from a requirements.txt File
Pitfalls & Solutions
The following are common pitfalls when working with pip and their solutions.
Last updated
Was this helpful?