Skip to content

Instantly share code, notes, and snippets.

@marcoandre1
Last active August 11, 2023 12:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcoandre1/a77460d7b88de7e9608335b9c518b752 to your computer and use it in GitHub Desktop.
Save marcoandre1/a77460d7b88de7e9608335b9c518b752 to your computer and use it in GitHub Desktop.
Install PyQt with pip command on windows 10

About

Installation guide to PyQt4 and PyQt5 on windows 10. Works with Python 3.7.3 32-bit and Python 3.7.3 64-bit (tested)

Installing

  1. Verify that python is installed and runnning by typing python --version on the command line.
  2. Verify that you have not installed PyQt before pip list.
  3. pip install PyQt5 this will install PyQt5.
  4. pip install pyqt5-tools this will install the designer.exe in your Scripts folder.
  5. If you need PyQt4 you will need to download the Windows wheel package. Choose your package according to your Python version. Example, if you are running Python 3.7.3 32-bits you should choose PyQt4‑4.11.4‑cp37‑cp37m‑win32.whl. To know your Python version you can type on the command line python -VV (Double -V argument gives more info on the vesion). You can also check the thread on StackOverflow.
  6. Run C:\path\where\wheel\is\> pip install PyQt4‑4.11.4‑cp37‑cp37m‑win32.whl. The path will probably be the downloads folder C:\Users\<user>\Downloads.
  7. If you are going to use designer or pyuic from PyQt4 with the command line you will need to add the path to PyQt4 folder to your path and probably move it over the python scripts so it gets read first.
    • First you need to search for the location of designer.exe in the PyQt4 folder. It should be in the Lib\site-packages folder as in the example below C:\Users\<user>\AppData\Local\Programs\Python\Python37\Lib\site-packages\PyQt4

      explorer image

    • Then you need to add the location to your path

      explorer image

    • Finally you will need to move it above the python scripts

      explorer image

  8. Type designer on the command line to start designer.exe (Note: if you had a command line open while updating your path, you first need to close it so the changes can take effect). You can verify that the version you are using is PyQt4 by going to Help > About Qt on the application bar menu. The first line should be This program uses Qt version 4.8.7. or something similar.
    • If your system is running on high-DPI your QtDesigner could look very small Small designer
    • To adjust the settings, you can right-click on the QtDesigner icon (you should pin it to the taskbar!) and go to the Properties tab

      explorer image

    • Then, you want to go to the Compatibility tab and click on Change high DPI settings

      explorer image

    • Tick Override high DPI scaling behavior and choose System from the dropbox. Click on OK and then on Apply

      explorer image

    • Finally, you can run again designer and while the resolution might be pixelated, you will be able to actually see something without forcing your eyes! Big designer

Happy coding

If you have a suggestion, comment or just found this guide useful, please let me know on the comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment