Notes: build pyQT5 development environment (Python3 + PyCharm 2018 + PyQt5)

Installation Environment

win7 64 Wei
Python 3.7
PyCharm 2018 Community Edition

pip list lists third-party Python packages that are currently installed

Installation PyQt5

In   cmd  the input
pip install PyQt5
Mounting station resource or by mirroring
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学:https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
In  cmd the python3 into the interactive environment  import PyQt5 there is no error, the installation is successful

Installation pyqt5-tools

In   cmd  input
pip install pyqt5-tools
or
pip install PyQt5-tools -i https://mirrors.aliyun.com/pypi/simple
After installation in the directory where you installed the python  \ib\site-packages\pyqt5-tools\designer.exe double-click  designer.exe on it to start the software
After installation, the installation directory will be added to the system environment variables
如 C:\Python36\Lib\site-packages\pyqt5-tools
Description: In the old version of PyQt5 .whl file contains tools such as Qt Designer.
But these tools are no longer available in the latest version of .whl file, it will be more focused on implementation-dependent PyQt5 application. In turn, related tools provided by PyQt5-tools, such as Qt Designer. Once PyQt5-tools installation can not install the Qt development tools

pip list   lists third-party Python packages that are currently installed


Configuration PyCharm 

PyCharm is disposed inside the opening in order to achieve the Pycharm Designer qt, qt then generate a file, and then converts the file into qt python language software files

Open settings, add an external tool

Add QtDesigner

The new version of designer.exe on \ Lib \ site-packages \ pyqt5_tools \ Qt \ bin under

Add PyUIC

Arguments: $FileName $ -o $FileNameWithoutExtension$_rc.py


Problems encountered summary
1. Installation Issues
Use pip install PyQt5 and pip install pyqt5-tools command
May be due to excessive delay the installation fails, try mirror sites resources
pip install PyQt5 -i https://mirrors.aliyun.com/pypi/simple
pip install PyQt5-tools -i https://mirrors.aliyun.com/pypi/simple

2. Test whether the installation is successful
Use pip list  command, lists third-party Python packages that are currently installed

3. Configure PyCharm 
Call an external tool QtDesigner, errors
ModuleNotFoundError: No module named 'PyQt5'
(Mounted PyQt5 package not added PyCharm item interpreter)
Solution:
When creating a new project, check

For existing projects
External Libraries found in the final surface of existing projects, then find venv directory, pyvenv.cfg file the following parameters into true
include-system-site-packages = true

Call PyUIC, errors
No such file or directory
or
one input ui-file must be specified
Solution:
1. conversion ui file, first select the ui file, and then call PyUIC tool
2.ui file command can not have spaces























Guess you like

Origin www.cnblogs.com/bog-box/p/11764252.html