TL;DR:

  • Install Astral UV using the official bash script.
  • Verify installation with version check.
  • Use UV for virtual environments and package management.

Step-by-Step Guide to Install Astral UV

Step 1: Install UV

Run the official bash script to install UV on macOS/Linux.

curl -LsSf https://astral.sh/uv/install.sh | sh

For Windows, use PowerShell:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Step 2: Verify Installation

Check that UV is installed correctly.

uv --version

Step 3: Basic Usage

Create a virtual environment and install packages.

uv venv myproject
source myproject/bin/activate  # On Windows: myproject\Scripts\activate
uv pip install requests

Usage Examples

Basic Package Installation

Install packages in a virtual environment.

uv pip install numpy pandas matplotlib

Running Scripts

Execute Python scripts with dependencies.

uv run python script.py

Project Management

Initialize a new Python project.

uv init myproject
cd myproject
uv add requests

References