Python Installation on Windows, Mac , Ubuntu , Fedora and CentOs
Installing Python on Different Operating Systems
Windows:
- Visit the official Python website.
- Download the latest Python installer for Windows (32-bit or 64-bit).
- Run the installer.
- Check the box labeled "Add Python X.Y to PATH" (replace X.Y with the version number).
- Click "Install Now" to start the installation.
- Open Command Prompt or PowerShell and enter
python
to verify the installation.
Checking if Python is Installed on Windows
- Open the Command Prompt:
- Press Windows + R, type
cmd
, and press Enter. - OR search for "Command Prompt" in the Start menu.
- Press Windows + R, type
- Type
python --version
and press Enter.- If Python is installed, the version number will be displayed.
- If not installed, you'll see an error message.
macOS:
- Visit the official Python website.
- Download the latest Python installer for macOS.
- Open the downloaded installer.
- Follow the on-screen instructions to install Python.
- Open Terminal and enter
python3
to verify the installation.
Checking if Python is Installed on Mac
- Open the Terminal:
- On macOS, find it in the Utilities folder within Applications.
- On most Linux distributions, find it using keyboard shortcuts like Ctrl + Alt + T.
- Type
python3 --version
and press Enter.- If Python 3 is installed, the version number will be displayed.
- If not installed, you might see an error or nothing at all.
Linux (Ubuntu example):
- Python is often pre-installed on many Linux distributions. Open a terminal and type
python3
orpython
to check. - If not installed, use the package manager. For example, on Ubuntu:
sudo apt update sudo apt install python3
- Access Python by typing
python3
in the terminal.
Checking if Python is Installed on Ubuntu
- Open the Terminal:
- On macOS, find it in the Utilities folder within Applications.
- On most Linux distributions, find it using keyboard shortcuts like Ctrl + Alt + T.
- Type
python3 --version
and press Enter.- If Python 3 is installed, the version number will be displayed.
- If not installed, you might see an error or nothing at all.
Linux (CentOS):
- Open a terminal on CentOS.
- Use the package manager to install Python. For example:
sudo yum update sudo yum install python3
- Access Python by typing
python3
in the terminal.
Checking if Python is Installed on Ubuntu
- Open a terminal on your CentOS system.
- Type the following command and press Enter:
python3 --version
If Python 3 is installed, the version number will be displayed. If it's not installed, you might see an error message or nothing at all.
- If Python 3 is not installed and you see an error or nothing, you can also try checking for Python 2:
python --version
However, it's important to note that Python 2 has reached its end of life and is no longer recommended for use.
If neither of the above commands displays a version number, it's likely that Python is not installed on your CentOS system. You can then proceed to install Python using the package manager. Here's the command to install Python 3 on CentOS:
sudo yum install python3
After the installation is complete, you can use the python3 --version
command to verify that Python is installed.
Remember that the availability of commands and package names might vary based on the specific version of CentOS and any updates that have occurred.
Linux (Fedora):
- Open a terminal on Fedora.
- Use the package manager to install Python. For example:
sudo dnf install python3
- Access Python by typing
python3
in the terminal.
Always refer to the official Python documentation for the most accurate and up-to-date instructions.