Files
gh-otoshek-claude-code-toolkit/skills/django-setup/platform-install/macos.md
2025-11-30 08:46:40 +08:00

3.2 KiB

Python Installation - macOS

Check Current Version

python3 --version

If you see Python 3.11+, you're good to go! ← Back to main skill


Installation Methods

Why Homebrew:

  • Easy updates: brew upgrade python@3.13
  • Manages dependencies automatically
  • Industry standard on macOS

Install Homebrew (if not installed):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Python 3.13:

brew install python@3.13

Verify installation:

python3.13 --version
# Or if it's the default:
python3 --version

Add to PATH (if needed):

echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc  # For M1/M2 Macs
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc     # For Intel Macs
source ~/.zshrc

Option 2: Official Python Installer

When to use: You want specific Python version or don't use Homebrew

Steps:

  1. Visit python.org/downloads
  2. Click "Download Python 3.13.x" button
  3. Open downloaded .pkg file
  4. Follow installation wizard
  5. Restart Terminal

Verify:

python3 --version

Add to PATH (if needed):

echo 'export PATH="/Library/Frameworks/Python.framework/Versions/3.13/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Option 3: pyenv (Multiple Python Versions)

Why pyenv:

  • Manage multiple Python versions side-by-side
  • Easy switching between projects
  • Preferred by professional developers

Install pyenv:

brew install pyenv

Install Python 3.13:

pyenv install 3.13.0

Set as global default:

pyenv global 3.13.0

Or set for specific project:

cd /path/to/project
pyenv local 3.13.0

Configure shell (add to ~/.zshrc):

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"

Reload shell:

source ~/.zshrc

Verify:

python --version  # Should show 3.13.0

Troubleshooting

Issue: command not found: python3

After Homebrew install:

brew link python@3.13

Check where Python is:

which python3
brew --prefix python@3.13

Issue: Multiple Python versions conflict

List all Python installations:

which -a python3
ls -l /usr/local/bin/python*

Use specific version:

python3.13 -m venv venv  # Force Python 3.13

Issue: SSL certificate errors

Install certificates:

/Applications/Python\ 3.13/Install\ Certificates.command

Or via Homebrew:

brew install openssl

Issue: Xcode Command Line Tools needed

Install:

xcode-select --install

Verification Checklist

  • python3 --version shows 3.11+
  • which python3 shows installation path
  • python3 -m pip --version works
  • python3 -m venv test_venv creates test environment
  • Can activate test venv: source test_venv/bin/activate

Clean up test:

rm -rf test_venv

← Back to django-project-setup