Chapter 2: Python Installation
Learn how to install Python on Windows, macOS, and Linux to start your coding journey.
Getting Started with Python Installation
Before writing Python code, you need to install Python on your computer. Python is available for Windows, macOS, and Linux, and the installation process is straightforward. This chapter guides you through downloading and setting up Python, verifying the installation, and preparing your environment for coding. By the end, you’ll have Python ready to run your first program.
Downloading Python
Visit the official Python website at python.org to download the latest version (e.g., Python 3.12 as of 2025). Choose the installer for your operating system:
- Windows: Download the executable installer (.exe).
- macOS: Download the macOS installer (.pkg).
- Linux: Most distributions (e.g., Ubuntu) include Python pre-installed, but you can update it using package managers.
Installing on Windows
Run the downloaded .exe file. Check the box to “Add Python to PATH” during installation to make Python accessible from the command line. Follow the prompts to complete the installation. After installation, open a Command Prompt and type python --version
to verify. You should see the installed version, e.g., “Python 3.12.0”.
Installing on macOS
Run the .pkg installer and follow the instructions. Once installed, open the Terminal and type python3 --version
to confirm. macOS may have Python 2 pre-installed, so use python3
to ensure you’re using Python 3. You can also install Python via Homebrew with brew install python
.
Installing on Linux
On Ubuntu, run sudo apt update
followed by sudo apt install python3
. Verify with python3 --version
. For other distributions, use the appropriate package manager (e.g., yum
for CentOS). Python is often pre-installed, but updating ensures you have the latest version.
Verifying Installation
After installation, open a terminal or command prompt and run:
python --versionor
python3 --versionThis displays the installed Python version. You can also start the Python interactive shell by typing
python
or python3
, where you can test simple commands like:
print("Hello, Python!")This should output “Hello, Python!” to confirm your setup.
Next Steps
With Python installed, you’re ready to explore its syntax in Chapter 3: Python Syntax. Use the sticky sidebar to navigate the 50-chapter learning path. For help, contact us at Contact or email info@bloggytech.com. Bloggy Tech, based in Wah Cantt, Pakistan, is here to support your learning journey.