Install Astral UV with the Official Bash Script

·
1 min read
tech python tools
#python #uv #astral #package-manager #rust

How to install Astral UV, the ultra-fast Python package manager written in Rust, using the official bash script method.

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.

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

For Windows, use PowerShell:

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

Step 2: Verify Installation

Check that UV is installed correctly.

Terminal window
uv --version

Step 3: Basic Usage

Create a virtual environment and install packages.

Terminal window
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.

Terminal window
uv pip install numpy pandas matplotlib

Running Scripts

Execute Python scripts with dependencies.

Terminal window
uv run python script.py

Project Management

Initialize a new Python project.

Terminal window
uv init myproject
cd myproject
uv add requests

References