To install Python on macOS, follow these steps:
Step 1: Check if Python is already installed
Open Terminal and run:
python3 --version
macOS comes with Python 2.x preinstalled (deprecated), but you want Python 3.x.
Step 2: Install Python 3 (Recommended via Homebrew)
1. Install Homebrew (if not installed)
Run this in Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Verify installation:
brew --version
2. Install Python 3
brew install python
This installs the latest Python 3 version and pip3
.
Verify installation:
python3 --version
pip3 --version
Step 3: Optional – Set Up a Virtual Environment
Navigate to your project folder and run:
python3 -m venv env
source env/bin/activate
To deactivate:
deactivate
Step 4: Test Python
Run Python interactive shell:
python3
You should see something like:
Python 3.x.x (default, ...)
>>>
Troubleshooting
-
If
python3
still shows the old version, try restarting the terminal or re-linking:brew link python
At Online Learner, we're on a mission to ignite a passion for learning and empower individuals to reach their full potential. Founded by a team of dedicated educators and industry experts, our platform is designed to provide accessible and engaging educational resources for learners of all ages and backgrounds.
Terms Disclaimer About Us Contact Us
Copyright 2023-2025 © All rights reserved.