Create and activate a virtual environment
Keeps this project’s packages separate from the system.
python3 -m venv .venv && source .venv/bin/activateCreate virtual environments, install and freeze packages with pip, and use uv, the fast modern Python package manager.
11 commands
Keeps this project’s packages separate from the system.
python3 -m venv .venv && source .venv/bin/activateIf activation is blocked, run: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
python -m venv .venv; .venv\Scripts\Activate.ps1Installs every package listed.
pip install -r requirements.txtWrites exact versions of everything in the environment.
pip freeze > requirements.txtUse python instead of python3 on Windows.
python3 -m pip install --upgrade pipuv is a very fast Python package and project manager.
curl -LsSf https://astral.sh/uv/install.sh | shPipes a script from the internet into your shell. This is the official installer; read it first if unsure.
Creates pyproject.toml, a starter main.py and a .gitignore.
uv init && cd Installs it into the project environment and records it in pyproject.toml.
uv add Runs inside the project environment, syncing dependencies first.
uv run Formats a JSON file with indentation. Also works on piped input.
python3 -m json.tool Path and version of the active interpreter.
which python3 && python3 --versionEvery command copies as plain, clean text: no curly quotes, no long dashes, no invisible characters.