Installing PYQT5 in a Windows system

Source: Internet
Author: User
Tags qt designer

1. Installing PYQT5
    • The official website of PYQT5 is https://www.riverbankcomputing.com. Up to now, the latest version is 5.11.
    • There are two ways to install PYQT5: You can download the latest source code for compilation and installation, or you can use it pip install for online installation.
    • It is recommended to use the pip install command for online installation, this is the simplest way, only need to run a single line of command.
      pip install PyQt5
    • The Python installation module uses the image default is foreign, because of network problems, download is slow, also often download failure, we recommend the use of domestic mirror. The following command is to use the image service provided by the watercress.
      pip install PyQt5 -i https://pypi.douban.com/simple
    • After the installation is complete, you will be prompted successfully installed pyqt5-5.11
2. Install common QT Tools
    • PYQT5 no longer offers the usual QT tools, the QT Designer, the internationalized translation tool Liguist, and the QT tool must be installed on its own.
    • Use the following command to install the QT tool.
      pip install PyQt5-tools
      Or
      pip install PyQt5-tools -i https://pypi.douban.com/simple
    • The PYQT5, pyqt5-tools directories can be seen in the Lib\site-packages directory in the Python installation directory after installation is complete.
3. Add the Pyqt5-tools installation directory to the system environment variable path.
    • Right-click My Computer on the desktop, select Properties, advanced system Settings, advanced, click the Environment Variables button in the popup shortcut menu, and add the absolute path to the Pyqt5-tools directory in the system variable path.
    • Enter the path command on the Windows command line. If everything is fine, you will see the path you just configured in the path that is returned.
4. Write test files to test whether the installation was successful. The code is as follows:
import sysfrom PyQt5.QtWidgets import QWidget, QApplicationapp = QApplication(sys.argv)widget = QWidget()widget.resize(640, 480)widget.setWindowTitle("Hello, PyQt5!")widget.show()sys.exit(app.exec())

If there is no error, a popup titled "Hello, Pyqt5!" window, the installation is successful.

Installing PYQT5 in a Windows system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.