Install virtualenv

virtualenv is a command-line tool, so it should be installed in an isolated environment rather than into your system Python. Pick the method that fits your setup:

  • uv – fast, modern Python package manager. Use this if you already have uv or are starting fresh.

  • pipx – installs Python CLI tools in isolated environments. Use this if you already have pipx set up.

  • pip – the standard Python package installer. Use --user to avoid modifying system packages. May not work on distributions with externally-managed Python environments.

  • zipapp – a self-contained executable requiring no installation. Use this in CI or environments where you cannot install packages.

        flowchart TD
    A{Can you install packages?} -->|Yes| B{Have uv?}
    A -->|No| Z[zipapp]
    B -->|Yes| U[uv tool install]
    B -->|No| C{Have pipx?}
    C -->|Yes| P[pipx install]
    C -->|No| D[pip install --user]

    style A fill:#d97706,stroke:#b45309,color:#fff
    style B fill:#d97706,stroke:#b45309,color:#fff
    style C fill:#d97706,stroke:#b45309,color:#fff
    style U fill:#16a34a,stroke:#15803d,color:#fff
    style P fill:#16a34a,stroke:#15803d,color:#fff
    style D fill:#7c3aed,stroke:#6d28d9,color:#fff
    style Z fill:#7c3aed,stroke:#6d28d9,color:#fff
    

Install virtualenv as a uv tool:

$ uv tool install virtualenv

Install the development version:

$ uv tool install git+https://github.com/pypa/virtualenv.git@main

Install virtualenv using pipx:

$ pipx install virtualenv

Install the development version:

$ pipx install git+https://github.com/pypa/virtualenv.git@main

Install virtualenv using pip:

$ python -m pip install --user virtualenv

Install the development version:

$ python -m pip install git+https://github.com/pypa/virtualenv.git@main

Warning

Some Linux distributions use system-managed Python environments. If you encounter errors about externally-managed environments, use uv tool or pipx instead.

Download the zipapp file and run it directly:

$ python virtualenv.pyz --help

Download the latest version from https://bootstrap.pypa.io/virtualenv.pyz or a specific version from https://bootstrap.pypa.io/virtualenv/x.y/virtualenv.pyz.

Verify installation

Check the installed version:

$ virtualenv --version

See Compatibility for supported Python versions.