Python Installation Guide

To start programming with Python, you first need to download and install it on your computer. This easy-to-follow guide covers all the steps to install Python correctly and set up your environment for smooth coding.

Whether you use Windows, macOS, or Linux, this tutorial will help you get Python up and running quickly, so you can begin writing and running Python programs without hassle.

Python Installation Methods

Here are 5 methods to download, install, and set up Python for your development environment.

  1. Official Installer
  2. Package Managers
  3. Anaconda Distribution
  4. Via IDEs
  5. Source Code

Install Python Using the Official Installer

The easiest way to install Python is by downloading the installer from the official Python website. Follow these simple steps to set up Python on your system:

Download Python Installer

  1. Download the Python installer from the official downloads page.
  2. Choose the version for your operating system: Windows, Linux, MacOS, or Other Platforms.
  3. Click download and save the installer to your device.

Run Python Installer

  1. Find the downloaded installer and run it.
  2. Make sure to check Add Python to Path to enable running Python from the command line.
  3. Click Install Now to start the installation.

Python Installation Installer

Verify Python Version

  1. Once the installation is complete, open a terminal or cmd(command prompt) to verify.
  2. Type the python --version command in CMD to verify the Python installation.
  3. This will display the Python version installed on the system, confirming successful installation.

Verify Version

Code
Output
Copy

python --version

Python 3.12.1

Python Installation Verification

If Python is not installed on your Windows system, typing python in CMD or Powershell will open the Microsoft Store to install it directly.

Python Installation Using Package Managers

Many platforms offer package managers that simplify software installation through the command line. See the table below for installation commands across different package managers.

OS Package Manager Terminal Command
OS-Independent pip pip install python
macOS Homebrew brew install python
Debian/Ubuntu apt
sudo apt update
sudo apt install python3
Red Hat/Fedora yum sudo yum install python3
Windows chocolatey choco install python

Each package manager uses its own commands to install Python, so choose one that suits your operating system and needs. Note: The package manager must be installed before using this method.

Install Python Using Anaconda Distribution

Anaconda is a popular open-source Python distribution tailored for data science and machine learning. It comes pre-installed with many scientific and analytics packages, making it a convenient and efficient choice for these fields.

Follow these simple steps to download and install Python using the Anaconda distribution:

Download Anaconda Distribution

  1. First, go to the official Anaconda download page to get the installer.
  2. Find the right version for your operating system: Windows, Linux, or macOS.
  3. Click download to save the Anaconda installer to your computer.

Run Anaconda Installer

  1. Open the downloaded Anaconda installer on your system.
  2. Follow the installation wizard and use the default settings to complete the setup.

Python Installation Anaconda Distribution Download

Verify Anaconda Version

  1. Next, verify that Anaconda is installed correctly on your system.
  2. Find Anaconda Prompt in the Start Menu under the Anaconda folder.
  3. Open the prompt and type conda --version to check the installation.
  4. This command will display the installed Anaconda version.

Anaconda Installation Verification

Installing Python Using IDEs

Many IDEs offer an easy way to install and manage Python. You can install Python directly by adding the Python extension within the IDE.

  • Installing Python through an IDE is quick and straightforward.
  • Simply open the IDE and add the Python extension or plugin.
  • Popular IDEs include VS Code, Thonny, PyCharm, and IDLE.

Python Installation from Source Code

This method is ideal for experienced developers who want full control over Python’s installation.

Download and Extract Source Code

  1. Visit the official Python source code page.
  2. Download the source code tarball (.tar.gz) for the version you need.
  3. Extract the tarball to your preferred directory.

Configure, Build, and Install

  1. Open a terminal in the directory where you extracted the source code.
  2. Run the commands below to configure and install Python on your system.

Example

Copy
./configure
make
sudo make install

The source code method for installing Python offers flexibility to configure and customize your setup, but it involves more manual steps and can be more complex.