Install and Use uv
Back to Module 3 | Back to Table of Contents
15 Installation of uv environmental management tool
uv is a Python package management and virtual environment tool developed with Rust. Its objectives are very clear:
It's not easy for Python to rely on management.
You can read uv as a combination of pip, venv, pip-tools.
Install uv tools
Install uv:
bash
curl -LsSf https://astral.sh/uv/install.sh | shUpon installation, confirm:
bash
uv --versionBasic use
Manage Python Versions
uv can easily manage several Python versions without additional tools such as pyenv.
View available Python versions:
bash
uv python listThe uv python command 3.11 can install a specific version of Python.
Create virtual environments
bash
uv venv .opencv --python 3.10.12Of which .opencv is the name of the virtual environment; 3.10.12 is a python version of the virtual environment.
Activate Virtual Environment
bash
source .venv/bin/activatePackage management
bash
# Install new packages:
uv pip install opencv-python
# uv pip install -r requirements.txt
# Uninstall packages:
uv pip uninstall requests
# Export the dependencies of the current environment
uv pip freeze > requirements.txt