The problem of: modulenotfoundererror: no module named ‘pyqt5’ appears in pychar using pyqt5

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

The problem that pychar does not recognize pyqt5 is shown in the figure. When pyqt5 is referenced, the error “module not found error: no module named ‘pyqt5′” is displayed

First, make sure that pyqt5 has been installed successfully

In the path of Python/python36/lib/site packages, see if there are pyqt5 related libraries. If pyqt5 is successfully referenced through Python commands, it means that pyqt5 is installed without problems. Python environment variable configuration is generally no problem, very few, if there is, it can not run

The latest version of pychar creates a python virtual environment by itself. By default, the third-party library you installed is not added to it, which causes this problem. In addition, when you create a new project, the label of project iterpreter is hidden and you can’t notice it. You need to open it manually, as shown in the following figure

Solution 1: when creating a new project, check the two boxes as shown in the figure below to load the third-party library

In this way, a pile of things will be loaded when the project is created. Another way is to use the following existing interpreter to handle it. Click the configuration button

If you have already built a project and don’t want to repeat the existing work, don’t worry, there are still ways

Find the external libraries at the end of the existing project, then find the venv directory, and change the following parameters in the pyvenv.cfg file to true

include-system-site-packages = true

It’s done

If you don’t find pyvenv.cfg, in your settings – > In the directory of projiect interpreter, find the file, modify it with Notepad, and then save it

Similar Posts: