Skip to content

Instantly share code, notes, and snippets.

@arkon108
Created January 6, 2025 11:14
Show Gist options
  • Save arkon108/0c42b519a7b901dcc04b46a957d6c828 to your computer and use it in GitHub Desktop.
Save arkon108/0c42b519a7b901dcc04b46a957d6c828 to your computer and use it in GitHub Desktop.
Initialize new Python project with uv
# install uv
# see https://github.com/astral-sh/uv
pip install uv
# verify uv works
uv --version
# navigate to your project
cs ~/my-project
# create virtual environment for your project
uv venv .venv
# alternatively, to create env with specific Python version
uv venv --python 3.12
# use a specific python version in existing venv, creates .python-version
uv python pin 3.12
# activate virtual environment
source .vent/bin/activate
# verify no packages are installed for the virtual env
uv pip list
# install packages in venv (with environment activated)
uv pip install <package name>
# exit the venv
deactivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment