02 Pyqt5 development environment + installation and configuration QtDesigner
1 Pycharm installation
For installation tutorial, please refer to: Installation Tutorial
2 Python installation
- Download address: official website download address ;
- Select the version to download according to your own system:
- Once the download is complete, just double-click to run it. The installation path is optional.
- Environment variable settings: If "Add environment variables" has been checked during installation, there is no need to set environment variables. If it is not checked, the environment variable setting method is as follows:
find your own Python installation path (for example, mine is: D:\Python 3.5), and add the following paths to the system environment variables.
Computer – Mail – Properties
Click "Advanced System Settings" and then "Environment Variables"
Find path in the system variable, double-click to open path, and then add at the end of the path: Python path, separated by ";", that is: D:\Python35; D:\Python35\Lib; D:\
Python35 \Scripts;
- Verify that Python is installed successfully:
Start - enter "cmd", press Enter to open the command line, enter: Python, if you see the following interface, it means that Python is installed successfully.
3 Pip installation
When installing python3.5 above, the pip tool has been installed by default. You can directly upgrade pip to the latest here.
python -m install --upgrade pip
4 PyQt5 installation
pip install pyqt5
pip install pyqt5-tools
5 Compilation tool settings in Pycharm and import of pyqt5 package
- Create a new project
- Ctrl+Alt+S, open the settings interface, click "Project Interpreter" under the project
- Click the settings button as shown in the picture
- Click "Add..."
- Set the compilation tool python.exe, select it according to your own path
- At this time, the package under the compilation tool will be automatically imported.
6 Specify Qt Designer
-
Ctrl+Alt+S, open the settings interface, click "Tools-External Tools", click "+"
-
The setting parameters are as follows:
① program:
D:\Python 3.5\Lib\site-packages\pyqt5_tools\Qt\bin\designer.exe,(换成自己的目录即可)
②arguments:
$FileDir$\$FileName$
③working directory:
$FileDir$
7 Specifying PyUIC5
- The steps are exactly the same as adding Qt Designer
- Function: A tool to convert qt UI files into .py files
- The specific parameters are as follows:
① program:
D:\Python 3.5\Scripts\pyuic5.exe(换成自己的目录即可)
②arguments:
$FileName$ -o $FileNameWithoutExtension$.py
③working directory:
$FileDir$
8 Specified PyRcc5
- The steps are exactly the same as adding PyUIC5
- Function: Convert resource files such as pictures into files that can be recognized by python code
- The specific parameters are as follows:
① program:
D:\Python 3.5\Scripts\pyrcc5.exe(换成自己的目录即可)
②arguments:
$FileName$ -o $FileNameWithoutExtension$.py
③working directory:
$FileDir$
9 PyInstaller installation
- Function: Packaging command: Go to the cmd console in the F:\Python 3.5\Scripts path and enter the command pyinstaller.exe -F f:\prj\hello.py to
generate a hello.exe independent executable file; do not use - The F command will generate dependent libraries together - Installation instructions:
pip3 install pyinstaller
10 Check whether the configuration is OK
In the main interface of Pycharm, click "Tools-External Tools" and you can see several external tools you have added.