Environment: Ubuntun14.04lts +anaconda4.2+tensorflow1.2+pycharm community2017.3.3
When running the. py file, 1. The Importerror:no module named appears Matplotlib.pyplot
2.
Appears Modulenotfounderror:no module Namedmatplotlib._path "
Explanation of Reason:
In the first case, there is importerror:no module named Matplotlib.pyplot
Reason: Matplotlib package not installed
Corresponding solution: Terminal terminal input sudo apt-get intall python-matplotlib
or pip install Matplotlib
In the second case, the Modulenotfounderror:no module Namedmatplotlib._path appears
Cause analysis: Anaconda, it directly all can use or not to import the package, may already contain matplotlib package, and pycharm inside already installed matplotlib bag;
So the Python compiler does not recognize two versions of the Matplotlib package, you need to remove one and put another package under the Anaconda directory to solve the problem
Use the PIP install Matplotlib to view the location of the Matplotlib package (if the Matplotlib package is already installed): Displays the installed success and location you have installed
(for example, I belong to the first case, direct installation can be completed through the PIP Install matplotlib view its installation path)