cave! `–` becomes often a single hyphen. Please be aware. (You see - it is actually a double hyphen :P).
| Replaces: pyenv | Purpose | Command |
| Install a specific Python version | uv python install <version> | |
| List available Python versions | uv python list | |
| Use a specific Python version in a project | uv python use <version> | |
| Automatically install the required Python version | uv run –python <version> script.py | |
| Pin the Python version for a project | uv python pin |
| Replaces: venv | Purpose | Command |
| Create a virtual environment | uv venv | |
| Create a virtual environment with specific Python ver. | uv venv –python <version> | |
| Activate virtual environment (Linux/macOS) | source .venv/bin/activate | |
| Activate virtual environment (Windows) | .venv\Scripts\activate | |
| Remove a virtual environment | uv remove | |
| Reinstall all dependencies in the virtual environment | uv sync –reinstall |
| Replaces: poetry | Purpose | Command |
| Initialize a new project | uv init <project-name> | |
| Add a package as a dependency | uv add <package-name> | |
| Add a dev dependency | uv add –dev <package-name> | |
| Add a package from Git | uv add git+https://github.com/user/repo.git | |
| Remove a package | uv remove <package-name> | |
| Lock dependencies to exact versions | uv lock | |
| Upgrade a specific package only on `uv.lock` | uv lock –upgrade-package <package-name> | |
| Upgrade all dependencies only on `uv.lock` | uv lock –upgrade | |
| Build a Python package | uv build | |
| Publish a package to PyPI | uv publish |
| Replaces: pip, pipx | Purpose | Command |
| Install a package | uv add <package-name> | |
| Remove a package | uv remove <package-name> | |
| Install dependencies from pyproject.toml | uv sync | |
| Install dependencies while excluding some groups | uv sync –no-group dev –no-group lint | |
| Install dependencies from requirements.txt | uv pip install -r requirements.txt | |
| Freeze dependencies into requirements.txt | uv pip freeze > requirements.txt | |
| Generate requirements.txt from uv.lock | uv export –format requirements-txt > requirements.txt | |
| Upgrade only the `uv.lock` file | uv lock –upgrade | |
| Upgrade all packages (`uv.lock` and execution) | uv sync –upgrade | |
| Upgrade a single package (`uv.lock` and execution) | uv sync –upgrade-package <package-name>
| |
|---|---|---|
| Install CLI tools globally | uv tool install <tool-name> | |
| List all installed tools | uv tool list | |
| Remove a globally installed CLI tool | uv tool uninstall <tool-name> | |
| Upgrade all installed CLI tools | uv tool upgrade –all |
| Replaces: Python Tools | Purpose | Command |
| Run a Python script inside the virtual environment | uv run <script.py> | |
| Run a script while automatically installing deps | uv run –with <package> python script.py | |
| Run a command inside the virtual environment | uv run – <command> | |
| Run a one-time CLI tool without installing globally | uvx <tool-name> –version | |
| Install a tool globally | uv tool install <tool-name> | |
| Upgrade a specific tool | uv tool upgrade <tool-name> | |
| Upgrade all installed tools | uv tool upgrade –all | |
| Enable shell auto-completion for uv | eval “$(uv generate-shell-completion bash)” |
@reneleonhardt Sorry for the late answer.
The official way would be not to transfer .venv manually but just to transfer
pyproject.tomlanduv.lockand.python-versionto your new project and runuv syncfor proper installation.Ok, let's say you don't have internet access in your second computer due to security reasons.
The way would be to transform your
uv.lockintorequirements.txtso that you can use the mechanism ofpipto transfer the wheels directly.:Transfer then the wheelhouse folder and requirements.txt file to the new computer. Transfer in addition your .python-version file!
So you could try this (I haven't tested this yet):
And maybe you can tell me, if it worked?