Skip to main content

Chapter 1: Getting started with Python Language

🛠️ Section 1.2: Setting Up Python

Installing Python on Different Operating Systems

Installing Python is straightforward across all major operating systems. Here’s a brief guide to get Python set up on your machine:

  • Windows:
    1. Download the latest version of Python from the official Python website.
    2. Run the installer. Make sure to check the box that says "Add Python 3.x to PATH" before clicking "Install Now."
    3. Follow the on-screen instructions to complete the installation.
  • macOS:
    • You can install Python using the Homebrew package manager. First, install Homebrew by opening the Terminal and running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

install Python using the Homebrew

    • Once Homebrew is installed, install Python by running:
brew install python

install Python by running

Python is usually pre-installed on Linux. To install Python 3, you can use the package manager of your distribution. For example, on Ubuntu, you would run:

sudo apt-get update
sudo apt-get install python3

pre-installed on Linux

Verifying Python Installation

Once Python is installed, you can verify the installation and check the version by opening your command line or terminal and typing:

python --version

Verifying Python Installation (Command)

or

python3 --version

This command should return the version of Python installed on your system. It is essential to ensure that Python is properly installed and accessible from your command line interface.

For further information on setting up your Python environment, visit the following resources:

By ensuring that Python is installed correctly, you'll be prepared to take full advantage of its capabilities for any project.