Install python
1. Download and install the software package.
Log in to the official website: https://www.python.org/downloads/
Select the version to download according to the operating system. My system here is a 64-bit system, so I chose the 64-bit installation package and tested the installation of 32-bit. It can also be used. Let’s install the 64-bit version here.
2. Install python
After downloading, double-click to start the installation. You can choose classic installation or custom installation. I choose custom installation here so that you can choose the installation directory.
3. Configure environment variables
and enter cmd input:
path=%path%;C:\Python\Python38
C:\Python\Python38 represents the installation path of python, which can be changed according to your own situation.
Add Scripts to it and enter again:
path=%path%;C:\Python\Python38\Scripts
4. To check whether the installation is successful,
type python in cmd and press Enter. The picture below indicates success.
Install PyQt5
1. After python is installed successfully, you can try the pip command in the cmd window. If there is no problem, we need to install sip first. The specific command is as follows:
pip install sip
2. Now you can install PyQt5, use the following command
pip3 install PyQt5
3. An error occurred during installation.
For such problems, you need to specify the installation path.
pip install --target=c:\python\python38\lib\site-packages urllib3
Adding the installation path after –target= will solve this problem.
However, you may still have the following problems in the future. The foreign source is too slow, and the progress is still there. It cannot be installed properly. Change to a domestic source.
pip install pyqt5 -i https://pypi.doubanio.com/simple/
4. Check it out
pip list
Try it on IDLE,
no error is reported when importing, it’s normal! !
5. Install the QT toolkit and continue to use Doubian’s source
pip install PyQt5-tools -i https://pypi.douban.com/simple