1

I installed python3 on Windows using the Anaconda installer. I then installed matplotlib using pip.

However, I can't get matplotlib to work in Sublime Text. When I try import matplotlib.pyplot as plt I get ModuleNotFoundError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package.

If I run python in the console it works fine.

It turns out I have two versions of python installed.

pip 20.1.1 from c:\programdata\anaconda3\lib\site-packages\pip (python 3.7)
python --version
Python 3.7.6

I saw that I can install for a specific version of python here: Python Pip Installing for Wrong Version

However none of py -3.7.6 -m pip install matplotlib, python-3.7.6 -m pip install matplotlib, python3.7.6 -m pip install matplotlib work and if I explicitly run pip with python 3.7.6 via C:\ProgramData\Anaconda3\python.exe -m pip install matplotlib it says already installed and I still get the same error.

How do I get matplotlib installed for python 3.7.6 so I can use it in Sublime Text?

1 Answer 1

0

Use this command :

python3.7 -m pip install matplotlib

You're not supposed to run python3.7.6 since you can have only one of the 3.7 versions installed.

Hope this works for you!

Sign up to request clarification or add additional context in comments.

3 Comments

Huh? I'm not following. I thought the issue is because I do have two 3.7 versions installed.
'python3.7' is not recognized as an internal or external command, operable program or batch file.
You're using anoconda, I'm not familiar with it, make sure to check on how to use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.