How to Run a Python REPL with uv
ℹ️
uv does not currently officially support a system-level installation of Python, however,
you can try it in preview mode.
To start an interactive Python REPL (Read-Eval-Print Loop) session using uv:
$ uv run python
This command will:
- Create or use an existing virtual environment if in a project (i.e. the project has a pyproject.toml file)
- Install any required dependencies
- Launch an interactive Python session
Using a Specific Python Version
To run the REPL with a particular Python version:
$ uv run --python 3.12 python
If the requested Python version is not installed, uv will download and install it automatically.
Running the REPL with Additional Dependencies
To run Python with specific packages available:
$ uv run --with pandas --with numpy python
This will create an isolated environment with the requested packages installed before launching the REPL.
Running the REPL Isolated from a Project
When working in a project directory but wanting to run a clean REPL without project dependencies:
$ uv run --no-project python
ℹ️
If you need regular access to a Python REPL, you could install IPython on the system level with
uv tool install ipython
. uv does not currently support a system-level installation of Python.Last updated on