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 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.

If your package is not present in PyPI, you can search for the 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:

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

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

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.

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

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.