Goals of this page #
- Install Python 3.13 and
uvon macOS Ventura / Sonoma - Learn how to create a virtual environment and manage libraries
- Understand the key points when integrating with editors such as VS Code
Prerequisites #
| Item | Details |
|---|---|
| Required tool | Homebrew (check with brew --version. If not installed, follow the official guide) |
| Shell | zsh (default) or bash. This guide assumes zsh |
| Working folder | We will use ~/Projects/my-app |
1. Install Python 3.13 #
brew update
brew install python@3.13
brew link python@3.13
python3.13 --version
You should see Python 3.13.x. If another version is linked, switch with brew unlink python@3.x.
2. Install uv #
curl -LsSf https://astral.sh/uv/install.sh | sh
Verify the command:
uv --version
If uv is not found, add ~/.local/bin to PATH.
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
3. Create the project folder and virtual environment #
mkdir -p ~/Projects/my-app
cd ~/Projects/my-app
uv venv --python 3.13 .venv
source .venv/bin/activate
When the prompt shows (.venv), the environment is active. Use deactivate to exit.
💡 You can also run commands without activating:
uv run python script.pyuses the environment automatically.
4. Install / sync libraries #
uv pip install numpy pandas
uv pip list
uv pip sync requirements.txt
uv pip install: add librariesuv pip list: inspect what is installeduv pip sync: rebuild fromrequirements.txt
5. Integrate with VS Code #
- Launch VS Code, open the Command Palette (
⇧⌘P) and choosePython: Select Interpreter - Pick
.venv/bin/pythonso the editor uses your environment - Recommended extensions: Python, Pylance, Black Formatter, Flake8 / Ruff
6. Common issues #
| Issue | Fix |
|---|---|
command not found: brew | Homebrew is missing. Install it via the official script |
uv not found | Add PATH in ~/.zshrc (or shell rc) and source it |
| Permission error when creating the environment | Check directory permissions (chmod, chown) and retry |
7. Clean-up #
- Leave the environment:
deactivate - Delete the environment:
rm -rf .venv - Save package list:
uv pip freeze > requirements.txt
macOS now has Python 3.13 + uv ready. Compare with the other OS guides for reference:
When you’re ready, move on to the next lesson to start learning Python.