Python - Install
To install Python on your system, follow these steps based on your operating system:
1. Windows Installation:
- Step 1: Go to the official Python website and download the latest version of Python for WinAdows.
- Step 2: Run the installer. Ensure that the checkbox for "Add Python to PATH" is selected before continuing.
- Step 3: Click on "Install Now" or customize the installation based on your preferences.
- Step 4: After installation, verify the installation by opening a Command Prompt and typing:bash
python --version
- This should show the installed Python version.
2. macOS Installation:
- Step 1: On macOS, Python 2.x is installed by default. However, you should install Python 3.x. Go to the Python website and download the latest Python installer for macOS.
- Step 2: Run the downloaded
.pkg
file and follow the installation instructions. - Step 3: After installation, verify it by opening the Terminal and typing:bash
python3 --version
- This will confirm the Python 3 installation.
Alternatively, you can use Homebrew (a package manager for macOS):
bashbrew install python
3. Linux Installation:
- On most Linux distributions, Python 3 is pre-installed. You can check by typing:bash
python3 --version
- If not installed, you can install Python via the package manager of your Linux distribution:
- Debian/Ubuntu:bash
sudo apt update sudo apt install python3
- Fedora:bash
sudo dnf install python3
- Arch Linux:bash
sudo pacman -S python
- Debian/Ubuntu:
Virtual Environment (Optional)
Once installed, you can use virtualenv
to create isolated Python environments:
bashpython -m venv myenv
Activate the virtual environment:
- On Windows:bash
myenv\Scripts\activate
- On macOS/Linux:bash
source myenv/bin/activate
This ensures your projects have their own dependencies without affecting system-wide packages.
For more detailed steps, refer to the official Python installation guide.