Python Getting Started

Satyam AadityaSatyam Aaditya
2 min read

Python Install

Installing Python on Windows:

  1. Go to the official Python website (https://www.python.org/downloads/) and download the latest version of Python for Windows.

  2. Run the downloaded installer file and select the "Add Python X.X to PATH" option during the installation process.

  3. Choose the "Customize installation" option to select specific components to install.

  4. Click "Install" and wait for the installation to complete.

  5. Verify the installation by opening the command prompt and typing "python --version". This should display the version of Python installed on your system.

Installing Python on Mac:

  1. Open the Terminal application on your Mac.

  2. Install Homebrew by running the command:

    
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

  3. Once Homebrew is installed, run the command brew install python to install Python.

  4. Verify the installation by opening the terminal and typing "python --version". This should display the version of Python installed on your system.

Alternatively, you can also download the official Python installer for Mac from the Python website and follow the installation steps similar to that of Windows.

Many PCs and Macs will have Python already installed.

To check if you have Python installed on a Windows PC, search in the start bar for Python or run the following on the Command Line (cmd.exe):

  
C:\Users\Your Name>python --version

To check if you have Python installed on a Linux or Mac, then on Linux open the command line or on Mac open the Terminal and type:

  
python --version

Steps to run the first program in Python

To run your first program in Python, you can follow these steps:

  1. Open a text editor, such as Notepad or Sublime Text.

  2. Type in the following code:

    
     print("Hello, World!")
     
    This code will print the message "Hello, World!" to the console.

  3. Save the file with a .py extension, such as "hello.py".

  4. Open a command prompt or terminal window.

  5. Navigate to the directory where you saved your Python file using the cd command.

  6. Type the command python hello.py to run the file. This will execute the code in the file and print the message to the console.

    Congratulations, you have successfully run your first program in Python!

0
Subscribe to my newsletter

Read articles from Satyam Aaditya directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Satyam Aaditya
Satyam Aaditya