Introduction
Before you start coding, you need to install Python on your system. Fortunately, Python works on Windows, macOS, and Linux. Here’s how you can get it running on your machine.
Installing Python on Windows
- Go to the official website: python.org/downloads
- Download the latest stable release (look for
Python 3.x.x). - Run the installer.
- Important: Tick the box
Add Python to PATHbefore clicking Install. - After installation, open Command Prompt and type:
You should see something like:python --versionPython 3.x.x
Installing Python on macOS
macOS usually comes with Python pre-installed, but it may be outdated.
- Download the latest version from python.org.
- Run the
.pkginstaller and follow instructions. - Verify installation by opening Terminal and typing:
python3 --version
Alternatively, you can install via Homebrew (if you have it):
brew install python
Installing Python on Linux
Most Linux distributions already include Python. To check:
python3 --version
If not installed, use your package manager:
- Ubuntu/Debian:
sudo apt update sudo apt install python3 - Fedora:
sudo dnf install python3 - Arch:
sudo pacman -S python
Verifying Your Installation
After installation, run:
python3 --version
If you see a version number (e.g., Python 3.11.5), Python is ready to use!
Mini Exercise (2 minutes)
Open your terminal/command prompt and type:
print("Hello from Python!")
Expected Output
Hello from Python!
What’s Next?
Now that Python is installed, let’s learn how to write your very first program.
No comments:
Post a Comment