Extra Information
Select python version to install
>>> uv python list
cpython-3.14.0b4-windows-x86_64-none <download available>
cpython-3.14.0b4+freethreaded-windows-x86_64-none <download available>
cpython-3.13.5-windows-x86_64-none <download available>
...Select python version to install
>>> uv python install 3.13
Installed Python 3.13.5 in 4.76s
+ cpython-3.13.5-windows-x86_64-noneuv python pin 3.13Make sure your pyproject.toml's requires-python setting is compatible, for example:
[project]
requires-python = ">=3.12"
uv venv --python 3.11.6pip install uv-
Create a new Python project with all configuration files and a virtual environment
-
This creates:
- .gitignore
- .python-version
- main.py
- pyproject.toml
- README.md
- uv.lock
uv init my-project
cd my-project--bare: only create pyproject.toml
- Add the
richpackage as a dependency
>>> uv add rich
Using CPython 3.12.3 interpreter at: C:\Users\miniconda3\python.exe
Creating virtual environment at: .venv
Resolved 5 packages in 46ms
Installed 4 packages in 263ms
+ markdown-it-py==3.0.0
+ mdurl==0.1.2
+ pygments==2.19.2
+ rich==14.0.0uv add -r requirements.txt: Import dependencies fromrequirements.txtinto thepyproject.tomland install them
- Create a file named main.py with the following content:
main.py
from rich.console import Console
console = Console()
console.print("[bold magenta]Hello, Rich![/bold magenta]")
console.print("This text is [green]green[/green] and this is [red]red[/red].")uv run python main.py
# or
uv run --python 3.13 python your_script.pyuv sync- Add the Jupyter kernel support to the environment
uv add ipykernel- Register the kernel with Jupyter
- Rename
--name(kernel name) and--display-name
- Rename
.venv\Scripts\python.exe -m ipykernel install --user --name=project-name --display-name "Project (uv)"