VSCode Python Configuration Guide
Overview
This guide will help you configure Visual Studio Code to use the latest Python version installed on your Mac.
Step 1: Install the Python Extension
- Open VSCode
- Click the Extensions icon in the left sidebar (or press Cmd + Shift + X)
- Search for "Python" (the official one by Microsoft)
- Click Install
This extension provides syntax highlighting, debugging, linting, and intellisense for Python.
Step 2: Select Your Python Interpreter
- Press Cmd + Shift + P to open the Command Palette
- Type "Python: Select Interpreter" and press Enter
- You'll see a list of available Python versions on your machine
- Select the latest version (should be Python 3.13 or your preferred version)
- Look for the one in
/opt/homebrew/bin/python3.13
- Look for the one in
Note: If you don't see your Python version listed, click "Enter interpreter path" and manually type the full path.
Step 3: Verify Your Selection
- Open VSCode's integrated Terminal: Ctrl + ` (backtick)
- Run the following commands:
python3 --version which python3
Both should confirm you're using the correct version (e.g., 3.13).
Step 4: Set as Default (Optional)
To make this your permanent default interpreter:
- Press Cmd + , to open Settings
- Search for "python.defaultInterpreterPath"
- Set the value to your Python path, for example:
/opt/homebrew/bin/python3.13
Step 5: Install Useful Extensions (Optional)
Consider installing these additional extensions for better development experience:
- Pylint – Code linting and error detection
- Black Formatter – Automatic code formatting
- Jupyter – If you work with notebooks
- Git Graph – Better git visualization
Step 6: Configure Python Linting (Optional)
- Press Cmd + , to open Settings
- Search for "python.linting"
- Choose your preferred linter (pylint, flake8, etc.)
- Enable it by checking the box
Verification Checklist
- [ ] Python extension installed
- [ ] Correct interpreter selected (3.13 or latest)
- [ ] Terminal shows correct Python version
- [ ] Can run Python scripts without errors
- [ ] IntelliSense is working (autocomplete suggestions appear)
Common Issues & Solutions
Issue: Python not found in terminal
Solution: Make sure you've added Python to your PATH in ~/.zshrc:
export PATH="/opt/homebrew/bin:$PATH"
Issue: VSCode still shows old Python version
Solution:
- Restart VSCode completely (Cmd + Q, then reopen)
- Clear the Python extension cache: Delete
~/.vscode/extensions/ms-python.python-* - Re-select the interpreter
Issue: Packages installed but not recognized
Solution: Install them in the same Python environment:
python3 -m pip install package_name
Useful VSCode Shortcuts
- Cmd + Shift + P – Command Palette
- Ctrl + ` – Toggle integrated Terminal
- Cmd + , – Open Settings
- Cmd + K Cmd + T – Select color theme
- Cmd + Shift + X – Open Extensions
Next Steps
- Create a test Python file:
test.py - Add some code:
print("Hello, Python 3.13!") - Run it: Ctrl + F5 or right-click and select "Run Python File in Terminal"
You're all set! Happy coding!