pycharm uses import numpy and import matplotlib to report errors

First of all, we solve the problem of error when importing numpy when using pycharm.

Solution 1: It may be that we have not installed the numpy third-party library. We open the file–>setting–>Project in the upper left corner of pycharm: pycharm coding–>Project interpreter. There is a plus sign in the upper right corner, click to add and enter numpy and wait for the download and installation Finish. (The first case generally does not exist, because Anaconda comes with a good library)
insert image description here
insert image description here
Solution 2: When installing Anaconda, it is impossible to use numpy without configuring environment variables. We directly uninstall Anaconda and reinstall it. All must be checked here.
insert image description here

Error using matplotlib.
The reason is that the related software or library is installed, but there is no path to call it. We then need to configure new environment variables.
Variable name: QT_QPA_PLATFORM_PLUGIN_PATH
Variable value: E:\Anaconda\pkgs\qt-5.9.6-vc14h1e9a669_2\Library\plugins, here you need to make changes according to your own installed Anaconda.
insert image description here
Restart pycharm and you can use it.

Related Posts