Install Selenium from a Wheel (.whl) File
Install Selenium from a Wheel (.whl) File
A Python Wheel file (.whl) is a pre-built package that can be installed using pip. You can install Selenium directly from the downloaded Selenium wheel file without downloading Selenium from PyPI.
Check Python Installation
Open Command Prompt and run:
python --version
Example output:
Python 3.12.5
Check pip
pip --version
Example:
pip 24.x.x from C:\Python312\Lib\site-packages\pip (python 3.12)
Locate the Selenium Wheel File
Suppose you have downloaded the Selenium wheel file to:
C:\Downloads\selenium-4.x.x-py3-none-any.whl
The exact filename depends on the Selenium version you downloaded.
Install Selenium from the Wheel File
Navigate to the folder containing the wheel file:
cd C:\Downloads
Then install it using:
pip install selenium-4.x.x-py3-none-any.whl
You can also provide the complete path:
pip install C:\Downloads\selenium-4.x.x-py3-none-any.whl
If You Have a Specific Python Version
On Windows, you can explicitly use Python’s module form of pip:
python -m pip install C:\Downloads\selenium-4.x.x-py3-none-any.whl
This is often preferable because it ensures that the package is installed into the pip environment associated with that Python installation.
Verify the Installation
Run:
python -c "import selenium; print(selenium.__version__)"
Example output:
4.x.x
Test Selenium with a Simple Python Program
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.google.com")
print(driver.title)
driver.quit()
If Selenium is installed correctly and Chrome/WebDriver setup is available, the browser will open and navigate to Google.
Important: Installing Dependencies
Installing a wheel file may require Selenium’s dependent packages to be installed as well. When pip has access to the internet, it can normally resolve and install these dependencies automatically.
For a completely offline installation, you should have the required dependency wheel files available and install them from your local folder.
pip install C:\Downloads\*.whl
Note: Installing every wheel in a folder is convenient only when the folder contains the packages you actually need.
Common Error
If you see an error such as:
ERROR: ... is not a supported wheel on this platform.
the wheel may not be compatible with your Python version or operating system. Check the wheel filename and make sure it matches your Python environment.
Quick Command
The simplest installation command is:
python -m pip install C:\Downloads\selenium-4.x.x-py3-none-any.whl
Then verify:
python -c "import selenium; print(selenium.__version__)"