I installed matplotlib.
But when i try to import it into my project import matplotlib.pyplot as plt
it say ModuleNotFoundError: No module named 'matplotlib'
pip list gives me: matplotlib 3.2.1
I am using Atom
I tried reinstalling matplotlib several times and every solution i could find on google, nothing seems to work.
A lot of things can make your code not to find the module, one of the common problem is having multiple python versions installed on your computer. Using a virtual environment to manage the project will help fix such problems on your project.
On your project directory, create a virtual environment with venvpython3 -m venv workspace
workspace is the name of the environment, you can give it any name you want
Activate the virtual environment
On PC use this codeworkspace\Scripts\activate.bat
On Mac/Linuxsource venv/bin/activate
Install matplotlib in the virtual environment and run your code
When you are done you could deactivate the environment with this codedeactivate
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.