How to Install Python on Linux
Step 1: Open the terminal.
Step 2: Check if Python is already installed on your system by typing the following command:
python3 --version
If Python is already installed, the version will appear. If not, you’ll need to install Python manually.
Step 3: Install Python using your system’s package manager. For Ubuntu or Debian, use:
sudo apt-get update
sudo apt-get install python3
For CentOS or Fedora, use:
sudo yum install python3
Step 4: Verify that Python is installed correctly:
python3 --version
If the version appears, Python has been successfully installed on your Linux system.
How to Install Python on Windows
Step 1: Download the Python installer from the official website: https://www.python.org/downloads/windows/
Step 2: Run the downloaded .exe installer file.
Step 3: Select “Add Python to PATH” and click Install Now. This will make Python accessible from the command line.
Step 4: After installation, open Command Prompt or PowerShell and type:
python --version
This command will show the installed Python version on your system.
If you want to create a virtual environment for your projects, install virtualenv and create a new environment using:
pip install virtualenv
virtualenv myenv
To activate the virtual environment, run:
.\myenv\Scripts\activate
Now you can install packages and run Python commands inside this virtual environment without affecting the global system.