Installing a Python package with a .whl file

To install a wheel package from the Python Package Index site (PyPI), open the console and run a package manager called PIP.

pip install some-package

PIP will look for a wheel file

Installing a wheel package from the disk

Start the command line as an administrator. Now, you have to make sure that PIP is up to date.

Run the following code. It will upgrade PIP.

python -m pip install --upgrade pip

If your package is not present in PyPI, you can search for Python package on unofficial sites. After you download a file, you can use a file archiver, such as 7zip and look inside it.

You will notice that the wheel consists of many py, txt, json, dll, and exe files.

I downloaded the following file:


It’s created for Python 3.7+ and 64-bit system.

Now, let’s navigate to that directory inside the command-line. I’m going to run the command with the name of the downloaded file.

pip install opencv_python-4.2.0-cp37-cp37m-win_amd64.whl

Run the pip freeze command to check whether the wheel is installed.

pip freeze | findstr opencv

As you can see, the wheel is installed with version 4.2.0.

Instead of navigating to the downloaded directory, you can type an absolute path to the file, and not just a name.

pip install C:\Users\Tom\Downloads\opencv_python-4.2.0-cp37-cp37m-win_amd64.whl