There exists a Windows version for this tool as well.
We recommend using UV if you struggle with various python language versions and environments!
#do not use sudo!
curl -LsSf https://astral.sh/uv/install.sh | sh
This will install the tool in your ~/.local/{bin,share/uv} directory. Add it to your PATH environment, if it is not yet done:
PATH=~/.local/bin:$PATH
Adding PATH=~/.local/bin:$PATH to your .profile makes it active when you login!
In this example we will install an older version python 3.10 to give you an idea of the possibility and make the environment in a directory called ~/test:
mkdir ~/test
cd test
uv venv --python 3.10 --seed
To activate use:
source .venv/bin/activate
In this eample we will install the pytorch packages with CUDA 12.6 for fast GPU calculations:
uv pip install torch torchvision torchaudio --torch-backend=cu126
Try if you can run this code:
uv run python -c "import torch; print(torch.rand(2,3).cuda())"
Or run your python script eg. main.py with the python version from your environment:
uv run main.py
If you have a project with a requirements.txt file, you can use:
uv pip sync requirements.txt
The complete documentation can be found here: https://docs.astral.sh/uv/ and the command reference: https://docs.astral.sh/uv/reference/cli/.
Using UV and python virtual environments gives alot of flexibility to maintain python in various projects.