How to Install Python and Configure Environment Variables in 2025 – Complete Beginner’s Guide

How to Install Python and Set Up Environment Variables in 2025

Python remains one of the most popular programming languages in 2025, loved by beginners and professionals alike for its versatility, readability, and vast ecosystem of libraries. Whether you’re diving into web development, data science, machine learning, or automation, installing Python correctly and setting up environment variables is an essential first step.

This guide will walk you through the installation process on Windows, macOS, and Linux, and explain how to set up environment variables so you can run Python seamlessly from your terminal or command prompt.


Why Learn Python in 2025?

Python continues to dominate the programming world due to its ease of learning, robust frameworks, and compatibility with modern technologies. From Django and Flask for web development to NumPy and Pandas for data analysis, Python is a language that adapts to your needs. In 2025, Python 3.x versions have improved speed, better error handling, and enhanced support for type annotations, making it even more powerful for professional projects.


Step 1: Download Python

To get started, head over to the official Python website. You will find download links for multiple operating systems. Always choose the latest stable release of Python 3.x for maximum compatibility and features.

  • Windows Users: Download the .exe installer.
  • macOS Users: Download the .pkg installer.
  • Linux Users: Python may already be pre-installed, but you can update it via your package manager.

Step 2: Install Python on Windows

  1. Run the downloaded .exe installer.
  2. Check the box that says “Add Python to PATH” before proceeding.
  3. Click Install Now for a quick setup, or choose Customize Installation if you want to specify a different directory.
  4. Wait for the installation to complete and then close the setup window.

Note: Adding Python to PATH here automatically sets your environment variables, but we’ll still show you how to do it manually later.


Step 3: Install Python on macOS

Using the Installer

  1. Open the downloaded .pkg file.
  2. Follow the installation wizard to complete the process.

Using Homebrew

If you have Homebrew installed, you can install Python directly from your terminal:

brew install python

Step 4: Install Python on Linux

Many Linux distributions come with Python pre-installed. However, you can install or upgrade it as follows:

For Ubuntu/Debian

sudo apt update
sudo apt install python3 python3-pip

For Fedora/CentOS

sudo dnf install python3 python3-pip

Step 5: Setting Up Environment Variables Manually (Windows)

Sometimes, Python is installed but not recognized in your command prompt. This happens when the PATH environment variable is not configured properly. Here’s how to fix it:

  1. Press Windows + S and search for Environment Variables.
  2. Click on Edit the system environment variables.
  3. In the System Properties window, click on Environment Variables.
  4. Under System variables, find and select Path, then click Edit.
  5. Click New and paste the path to your Python installation directory (e.g., C:\Python311\).
  6. Also, add the Scripts folder path (e.g., C:\Python311\Scripts\).
  7. Click OK to save your changes.

Step 6: Setting Up Environment Variables (macOS & Linux)

For macOS and Linux, you’ll need to edit your shell configuration file:

nano ~/.bashrc

Add the following line (replace /usr/local/bin/python3 with your Python path):

export PATH="/usr/local/bin/python3:$PATH"

Save the file, then run:

source ~/.bashrc

If you’re using zsh, edit ~/.zshrc instead.


Step 7: Verify Installation

To confirm Python is installed correctly, open your terminal or command prompt and run:

python --version

Or for some systems:

python3 --version

You should see the version number displayed. To check if pip (Python’s package manager) is installed, run:

pip --version

Step 8: Updating Python in 2025

  • Windows/macOS: Download and install the latest version from the official Python website.
  • Linux: Use your package manager to update, or install via source.

Common Problems & Solutions

  • Python not recognized: Ensure the PATH variable is set correctly.
  • Multiple versions conflict: Use pyenv or conda to manage versions.
  • Permission errors on Linux: Use sudo when installing packages, or use virtual environments.

Conclusion

Installing Python and setting up environment variables is a foundational step for any developer in 2025. Once configured, you can run Python scripts from anywhere in your system, manage dependencies efficiently, and dive into exciting projects like web applications, data pipelines, or AI tools. Follow this guide carefully, and you’ll have a smooth Pytho