Taufan Mahardhika
Taufan Mahardhika

Reputation: 53

How to install Matplotlib in Python 3 on Windows

Matplotlib tell us that the requirement is Python 2.4 or later but not Python3.

Now I'm working with Python3 and I need some plot from Matplotlib.

So how do I solve it?

Upvotes: 5

Views: 7345

Answers (5)

Ola Ström
Ola Ström

Reputation: 5301

In Visual Studio 2022 just use the "Solution Explorer" to install Matplotlib.

  • Expand the Project and then expand the "Python Environments"
  • Right click on the Python installation and choose "Manage Python Packages..."

Solution Explorer

  • Type "matplotlib" in the search field
  • Click on "Run command: pip install matplotlib"

Python Environment

Now Matplotlib should be installed on the Visual Studio Python environment!

Note that if the chosen Python environment is:

  • "Python 3.XX (global default)"
    Then Matplotlib will be installed on your default Visual Studio Python environment,
  • NOT the (global default)
    Then Matplotlib will JUST be installed on your current project.

Upvotes: 1

lopezdp
lopezdp

Reputation: 1567

Looking at the docs at the link it says the following is a dependency:

Python (>= 2.7 or >= 3.4)

You can download a version of Python that will work at:

https://www.python.org/downloads/windows/

I would go with the most recent release and a 64 bit version as certain libraries for data analysis do not run on the 32 bit version of Python.

The version of Python you download will come with pip which you can then use to install any libraries you need to do your work.

Make sure you have set your environment variables if you want to run your programs from the command line or bash terminal.

I installed matplotlib through the bash terminal with:

pip install matplotlib

Let me know if that helps.

Upvotes: 1

Chirag goyal
Chirag goyal

Reputation: 494

To install matplotlib on windows, first, you have to install pip first to install pip on windows go to website

https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip

Download get-pip.py, being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:

python get-pip.py

if pip is already installed, install matplotlib by writing in command prompt:

python -mpip install -U pip
python -mpip install -U matplotlib

Upvotes: 0

Jay
Jay

Reputation: 1422

You could try the unofficial versions. Check this site:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Upvotes: 2

Agos
Agos

Reputation: 19390

I'm sorry, but at the current time it's not supported.
If you feel brave, you can try with the Py3k SVN branch which reportedly works with a simple example. Be aware that there has been no update in the last 8 months on this though. Of course, you'd be more than welcome to contribute to the porting to Python 3 if you could.

Upvotes: 2

Related Questions