Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install PyQt5 for Pycharm

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to install PyQt5 in Pycharm". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install PyQt5 in Pycharm.

1. Install the plug-in

Douban net image is used for installation here, because the installation speed is very slow.

Pip3 install PyQt5- I https://pypi.douban.com/simplepip3 install PyQt5-tools-I https://pypi.douban.com/simple# PyQt5-stubs is a package that checks pyqt5 syntax. You may not have to install pip3 install PyQt5-stubs-I https://pypi.douban.com/simple2. at first. Configure Pycharm

Open Pycharm and click File-- > Setting-- > Tools-- > External Tools

If it has just been installed and there is no data on the right, just add it and click the'+ 'sign to add it.

Program: is the path where designer.exe is located. Different versions may store different paths, so you have to find them yourself.

Some have the installation path%\ Lib\ site-packages\ pyqt5_tools\ designer.exe of% Python.

Some have the installation path of% Python%\ Lib\ site-packages\ pyqt5_tools\ Qt\ bin\ designer.exe

For Working directory, fill in "$FileDir$", or click on the right side of Insert Macro..., and find "$FileDir$".

This tool can be used to write UI, the following is to set up a UI into a py file.

Program: is the path where Python is installed

Arguments:-m PyQt5.uic.pyuic $FileName$-o $FileNameWithoutExtension$.py

Working directory: "$FileDir$"

Setup complete

3. Conduct a test

Write a UI

First, right-click on the file path where you need to write UI and select External Tools-- > Designer

Casually create a new window, and then drag several components to save, such as: test.ui

Then convert ui to a py file, right-click test.ui-- > External Tools-- > PyUIC

Open the generated py file and add the following code

Import sysfrom PyQt5.QtWidgets import QApplication, QMainWindow if _ _ name__ = ='_ main__': app = QApplication (sys.argv) MainWindow = QMainWindow () ui = Ui_MainWindow () ui.setupUi (MainWindow) MainWindow.show () sys.exit (app.exec_ ())

Run directly, if there is no problem, it means everything is normal.

At this point, I believe you have a deeper understanding of "Pycharm how to install PyQt5". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report