Importing Matplotlib.pyplot In Atom Editor
Solution 1:
From The Module Search Path.
When a module named spam is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file named spam.py in a list of directories given by the variable
sys.path
.sys.path
is initialized from these locations:
- the directory containing the input script (or the current directory).
- PYTHONPATH (a list of directory names, with the same syntax as the shell variable PATH).
- the installation-dependent default.
Which means you should avoid naming your modules with the same name as standard-library or built-in module names.
So you should rename your script file instead of matplotlib.py
.
Solution 2:
I faced a error like below while trying to import Matplotlib from atom:
Traceback (most recent call last): File "lanes.py", line 3, in import matplotlib.pyplot as plt ModuleNotFoundError: No module named 'matplotlib'.
All I did is go to my C:\Users*user_name*.atom directory in command prompt and type pip3 install matplotlib. Now it works fine.
So in command prompt you need to give something like below:
C:\Users\*user_name*\.atom>pip3 install matplotlib.
Hope it works.
Post a Comment for "Importing Matplotlib.pyplot In Atom Editor"