Installing Python on Your local Machine
Installing on Windows, macOS, Linux, and other operating systems
To install Python on your local machine according to your operating system, refer to the following instructions.
Windows
Download Python:
Go to the official Python website page: Python Releases for Windows and download the latest stable release.
Click on the "Downloads" tab and select the latest version of Python for Windows.
Download the installer (usually a
.exe
file).
Install Python:
Run the downloaded installer.
Make sure to check the box that says "Add Python to PATH" before clicking "Install Now".
Follow the prompts to complete the installation.
Verify Installation:
Open Command Prompt (type
cmd
in the search bar and press Enter).Type
python --version
and press Enter. This should display the installed Python version.Type
pip --version
to check the pip installation.
Install a Virtual Environment:
In Command Prompt, navigate to the directory where you want your project.
Run
python -m venv env
to create a virtual environment namedenv
.Activate the virtual environment with
.\env\Scripts\activate
.You can deactivate it with
deactivate
.
Install Packages:
Install any required packages needed for deloping your automation scripts.
macOS
Download Python:
Go to the official Python website page: Python Releases for macOS and download the latest stable release.
Install Python:
Open the downloaded
.pkg
file and follow the instructions to install Python.
Verify Installation:
Open Terminal (you can find it in Applications > Utilities).
Type
python3 --version
to check the Python installation.Type
pip3 --version
to check the pip installation.
Install a Virtual Environment:
In Terminal, navigate to your project directory.
Run
python3 -m venv env
to create a virtual environment namedenv
.Activate the virtual environment with
source env/bin/activate
.You can deactivate it with
deactivate
.
Install Packages:
Install any required packages needed for deloping your automation scripts.
Linux
Install Python:
Most Linux distributions come with Python pre-installed. You can check by typing
python3 --version
in Terminal.If Python is not installed, you can install it using your package manager. For example, on Debian-based systems (like Ubuntu):
sudo apt update sudo apt install python3 python3-pip python3-venv
Install Packages:
Install any required packages needed for deloping your automation scripts.Install a Virtual Environment:
In Terminal, navigate to your project directory.
Run
python3 -m venv env
to create a virtual environment namedenv
.Activate the virtual environment with
source env/bin/activate
.You can deactivate it with
deactivate
.
Common Steps (after setting up the environment)
Upgrade pip:
pip install --upgrade pip
Install a Virtual Environment:
Use
pip install package_name
to install packages.Example:
pip install numpy pandas matplotlib
.
Freeze Requirements (optional):
Create a
requirements.txt
file to record the dependencies.Run
pip freeze > requirements.txt
.
Install Requirements (optional):
Use
pip install -r requirements.txt
to install all packages listed in therequirements.txt
.
Other Operating Systems
Visit Download Python for Other Platforms to download and install Python for other operating systems.