This guide provides step-by-step instructions on installing Python and pip using the terminal on both Windows and macOS/Linux systems.
-
Download Python:
- Visit the official Python website at https://www.python.org/downloads/.
- Click on "Downloads" and select the latest version of Python for Windows (e.g., "Python 3.x.x").
-
Run the Installer:
- After downloading, open the executable file (usually a .exe) you downloaded.
- Make sure to select the "Add Python x.x to PATH" option during installation. This allows you to run Python from the command prompt without specifying the full path.
-
Verify the Installation:
- Open the command prompt and type:
You should see the installed Python version.
python --version
- Open the command prompt and type:
-
Upgrade pip (Optional but Recommended):
- Run the following command in the command prompt:
python -m pip install --upgrade pip
- Run the following command in the command prompt:
-
Check for Existing Python:
- Many Linux distributions and macOS come with Python preinstalled. Check the current version using the following command in the terminal:
python --version
- Many Linux distributions and macOS come with Python preinstalled. Check the current version using the following command in the terminal:
-
Update the System (Optional but Recommended):
- To ensure you have the necessary development tools, update your system with the following commands:
- Ubuntu/Debian:
sudo apt update sudo apt upgrade
- Fedora:
sudo dnf update sudo dnf upgrade
- Ubuntu/Debian:
- To ensure you have the necessary development tools, update your system with the following commands:
-
Python Installation:
- If Python is not already installed, use the package manager for your distribution. For example, on Ubuntu/Debian, you can use:
sudo apt install python3
- If Python is not already installed, use the package manager for your distribution. For example, on Ubuntu/Debian, you can use:
-
Verify the Installation:
- Confirm that Python is installed correctly with the command:
python3 --version
- Confirm that Python is installed correctly with the command:
-
pip Installation:
- Use the appropriate package manager for your system and install the
python3-pip
package (orpython-pip
on some distributions):- Ubuntu/Debian:
sudo apt install python3-pip
- Fedora:
sudo dnf install python3-pip
- Ubuntu/Debian:
- Use the appropriate package manager for your system and install the
-
Upgrade pip (Optional but Recommended):
- Run the following command in the terminal:
python3 -m pip install --upgrade pip
- Run the following command in the terminal:
You have now successfully installed Python and pip on your system, and you are ready to start developing with Python!