Introduction
After installing Python, the next step in setting up your Selenium automation environment is installing pip.
pip is Python’s official package manager. It allows you to install, update, uninstall, and manage third-party Python packages with simple commands.
In Selenium automation, pip is used to install essential libraries such as Selenium, PyTest, WebDriver Manager, Requests, and many other packages required for building automation frameworks.
In this tutorial, you’ll learn what pip is, how to install it on Windows, macOS, and Linux, verify the installation, and follow best practices.
What is pip?
pip stands for Preferred Installer Program.
It is the default package manager for Python and is used to download and install packages from the Python Package Index (PyPI).
Instead of manually downloading libraries from different websites, pip installs them using a single command.
For example, Selenium can be installed using:
pip install selenium
Why is pip Required?
pip makes package management simple and efficient.
It allows you to:
Install Python packages
Update existing packages
Uninstall packages
Manage package versions
Install project dependencies
Build automation frameworks
Without pip, installing and maintaining Python libraries would be much more difficult.
Check if pip is Already Installed
Modern versions of Python (Python 3.4 and above) include pip by default.
Before installing pip, verify whether it is already available.
Windows
Open Command Prompt and run:
pip --version
macOS / Linux
Open Terminal and run:
pip3 --version
Example Output
pip 25.x.x from ...
If the version is displayed, pip is already installed and ready to use.
Installing pip on Windows
If pip is not installed, follow these steps.
Step 1: Download get-pip.py
Download the get-pip.py installation script from the official Python Packaging Authority.
Save the file to your computer.
Step 2: Open Command Prompt
Navigate to the folder containing get-pip.py.
Example:
cd Downloads
Step 3: Install pip
Run the following command:
python get-pip.py
Wait for the installation to complete.
Step 4: Verify Installation
Run:
pip --version
If the version number appears, pip has been installed successfully.
Installing pip on macOS
Most recent Python installations on macOS include pip automatically.
If pip is missing:
Step 1: Download get-pip.py
Download the get-pip.py script.
Step 2: Install pip
Run:
python3 get-pip.py
Step 3: Verify Installation
pip3 --version
Installing pip on Linux
Most Linux distributions install pip separately.
Ubuntu / Debian
Update package information:
sudo apt update
Install pip:
sudo apt install python3-pip
Verify:
pip3 --version
Fedora
Install pip:
sudo dnf install python3-pip
Verify:
pip3 --version
CentOS / RHEL
Install pip:
sudo yum install python3-pip
Verify:
pip3 --version
Installing Your First Python Package
Once pip is installed, you can install Python packages.
For example, install Selenium:
pip install selenium
On macOS or Linux, you may use:
pip3 install selenium
pip automatically downloads and installs Selenium along with its required dependencies.
Upgrading pip
It is recommended to keep pip updated.
Windows
python -m pip install --upgrade pip
macOS / Linux
python3 -m pip install --upgrade pip
Useful pip Commands
Check pip Version
pip --version
List Installed Packages
pip list
Show Package Information
pip show selenium
Upgrade a Package
pip install --upgrade selenium
Uninstall a Package
pip uninstall selenium
Common Installation Issues
pip Command Not Recognized
Error
'pip' is not recognized as an internal or external command
Solution
Ensure Python is installed correctly and that the Python Scripts directory has been added to the system PATH.
Permission Denied
Error
Permission denied
Solution
Use administrator privileges or the sudo command on Linux/macOS.
Example:
sudo pip3 install selenium
Multiple Python Versions
If multiple Python versions are installed, use:
python -m pip --version
or
python3 -m pip --version
to ensure you’re using the correct pip installation.
Best Practices
Use the latest version of pip.
Install packages only from trusted sources such as PyPI.
Keep project dependencies updated.
Use virtual environments for Selenium projects.
Verify package installation after every install.
Avoid installing unnecessary global packages.
Frequently Asked Questions (FAQs)
What is pip?
pip is Python’s official package manager used to install and manage Python libraries.
Is pip installed automatically?
Yes. Most modern Python installations include pip by default.
Why do we need pip for Selenium?
pip is used to install the Selenium library and other packages required for automation testing.
How do I check if pip is installed?
Run:
pip --version
or
pip3 --version
Can I update pip?
Yes.
Use:
python -m pip install --upgrade pip
or
python3 -m pip install --upgrade pip
Key Takeaways
pip is Python’s official package manager.
It is used to install, update, and manage Python packages.
Most modern Python installations include pip by default.
Verify the installation using
pip --versionorpip3 --version.pip is required to install Selenium and other automation libraries.
Keeping pip updated ensures compatibility with the latest Python packages.
Understanding pip is essential before installing Selenium and building automation projects.
