This guide explains how to install UV, set up Python 3.11, and manage dependencies for your project.
UV is a fast, modern Python package and environment manager. To install it, run the following command in your terminal:
curl -LsSf https://astral.sh/uv/install.sh | shAfter installation, restart your terminal or run the command displayed at the end of the installer (usually something like source ~/.profile or source ~/.bashrc) so the uv command becomes available.
You can verify the installation with:
uv --versionUV can manage multiple Python versions for you. To install Python 3.11, run:
uv python install 3.11Then confirm the version is available:
uv python listIf you want to make Python 3.11 the default for this project:
uv python pin 3.11uv pip install .If you need to add a new dependency:
uv add <package-name>You have two options when working in your project environment:
source .venv/bin/activateThen you can run your scripts normally:
python script.pyRun scripts directly using UV without manually activating the environment:
uv run python script.pyYou can also use it for other Python commands, like:
uv run pytest
uv run jupyter notebook| Step | Description |
|---|---|
| 1 | Install UV package manager |
| 2 | Install Python 3.11 |
| 3 | Install your dependencies |
| 4 | Run scripts via uv run or activate the environment |