Step 1: Download Python
Download the latest version of Python from the official website.
- Select the version for your OS (Windows, macOS, or Linux).
- Choose the recommended installer.
- Download the installer.
Step 2: Run the Installer
Run the downloaded installer. The steps are slightly different for each OS:
Windows
- Double-click the
.exefile. - Important: check “Add Python to PATH”.
- Click Install Now (or Customize installation for advanced options).
macOS
- Double-click the
.pkgfile. - Follow the on-screen instructions.
Linux
Python may already be installed. Check with:
python3 --version
If not installed, use your package manager:
# Debian/Ubuntu
sudo apt update
sudo apt install python3 python3-pip
# Fedora/CentOS/RHEL
sudo dnf install python3 python3-pip
# Arch Linux
sudo pacman -S python python-pip
Note: On Linux and macOS, prefer
python3 and pip3 to ensure Python 3 is used.
Step 3: Verify Installation
Open a terminal and check versions:
python --version # or: python3 --version
pip --version # or: pip3 --version
Step 4: Choose a Code Editor/IDE
Beginner-friendly options:
- Visual Studio Code (recommended): Download
- Thonny: Download
- PyCharm Community Edition: Download
- IDLE: Ships with Python.
Set up VS Code for Python
- Install the official Python extension by Microsoft.
- Install Pylance for intelligent code completion and type checking.
Step 5: Write Your First Program
Create a file named hello.py and add:
print("Hello, World!")
Save, open a terminal, navigate to the file, and run:
python hello.py # or: python3 hello.py
You should see Hello, World! in the output. 🎉