Python Central HubSign in

Python Programming

Installation Guide

How to install Python and set up your development environment. This guide covers the installation process for Windows, macOS, and Linux.

To get started with Python Central Hub and make the most of our tutorials and projects, you'll need to have Python installed on your machine. Follow these simple steps to install Python and set up your development environment.

Step 1: Download Python

Visit the official Python website at python.org to download the latest version of Python. We recommend downloading the latest stable release for your operating system.

  • Windows: Download the installer executable and run it.

  • macOS: Download the macOS installer and follow the installation instructions.

  • Linux: Most Linux distributions come with Python pre-installed. If not, use your package manager to install Python.

Step 2: Verify Installation

Once the installation is complete, it's essential to verify that Python has been installed correctly. Open a command prompt (or terminal) and enter the following command:

Shell
python --version

You should see the Python version number displayed, indicating a successful installation.

cmd
C:\Users\Your Name> python --version
Python 3.12.2

Also confirm that pip, Python's package installer, came along with it:

cmd
C:\Users\Your Name> pip --version
pip 24.0 from C:\...\site-packages\pip (python 3.12)

It is good practice to upgrade pip right away:

Shell
python -m pip install --upgrade pip

Step 3: Install a Code Editor (Optional)

While Python can be written and run using a simple text editor, using a dedicated code editor can enhance your development experience. Choose a code editor that suits your preferences; popular choices include:

A virtual environment is an isolated folder that holds its own copy of Python and its own installed packages. Each project gets its own, so upgrading a library for one project never breaks another. This is the single most important habit for a clean Python setup.

Diagram:

diagram why use a virtual environment mermaid
Isolated dependencies per project

To manage project dependencies and ensure a clean development environment, consider setting up a virtual environment. In your project directory, run:

Shell
python -m venv venv

Activate the virtual environment:

  • On Windows:
    Shell
    .\venv\Scripts\activate
  • On macOS/Linux:
    Shell
    source venv/bin/activate

Once activated, your prompt shows (venv). Install packages with pip, record them in a requirements.txt, and run deactivate when finished:

Shell
pip install requests
pip freeze > requirements.txt   # save the exact versions
deactivate                      # leave the environment

Step 5: Ready to Code!

With Python installed and your development environment set up, you're now ready to explore the tutorials and projects on Python Central Hub. Start with our Introduction to Python tutorial to kick off your Python journey!

If you encounter any issues during the installation process or have questions, feel free to reach out to our community forums for assistance.

Happy coding with Python Central Hub!


Try it: Verify Your Setup in the Browser

Exercise 1 – Hello, World!

exerciseYour turn

Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.

Output
Press Run to see what your code prints.

Exercise 2 – Check Python Version

exerciseYour turn

Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.

Output
Press Run to see what your code prints.

Exercise 3 – Simple Arithmetic

exerciseYour turn

Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.

Output
Press Run to see what your code prints.

Was this page helpful?

Let us know how we did