Here’s a step-by-step guide on how to install Python on your computer:
Windows
-
Download the Installer:
- Visit the official Python website:
https://www.python.org/downloads/ - Download the latest Python
3 version suitable for your Windows system (32-bit or 64-bit).
- Visit the official Python website:
-
Run the Installer:
- Double-click the downloaded installer file.
- Important: During the installation process, make sure to check the box that says “Add Python to PATH.” This will allow you to run Python from the command prompt.
-
Complete the Installation:
- Follow the on-screen instructions to complete the installation process.
macOS
Using Homebrew (Recommended):
- Install Homebrew:
- Open Terminal and run the following command:
Bash/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Open Terminal and run the following command:
- Install
Python: - Run the following command in Terminal:
Bashbrew install python3
- Run the following command in Terminal:
Manual Installation:
- Download the Installer:
- Visit the official Python website and download the macOS installer.
- Run the Installer:
- Double-click the downloaded installer file and follow the on-screen instructions.
Linux
Using the Package Manager:
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install python3 python3-pip
Fedora/CentOS:
sudo dnf install python3 python3-pip
Other Linux Distributions:
Check the package manager for your specific distribution (e.g., yum
, pacman
, zypper
).
Verifying the Installation:
- Open your terminal or command prompt.
- Type
python3
and press Enter. - If Python is installed correctly, you should see the Python version and a prompt.
Installing Packages with pip:
pip
is a package installer for Python. You can use it to install additional libraries and modules. Here’s an example of how to install the popular numpy
library:
pip install numpy