As others have stated, Python 3.10 is not currently compatible with Matplotlib.
You need to install and use Python 3.9 until it is supported. Until then you have a few options:
You can use the Python Launcher for Windows (py.exe) script to choose which Python version to run like so:
py.exe script help:
List all installed versions
Use a specified version
Create a virtual environment using python 3.9
py -3.9 venv .venv
install matplotlib with pip using python 3.9
py -3.9 -m pip install matplotlib
On Linux you can run whatever Python version you like like so:
You can set up a local (your working directory and all sub-directories) virtual environment that will use your specified version like so:
python3.9 -m venv .venv
Which will set the version of python used to 3.9 while in the local directory, and allow you to type
python instead of
python3.9 each time you need it.
Another relevant and helpful post by Rotareti here.
Please note that I have not described how to activate and use Python Virtual Environments here in detail, for more information on using them read the python docs.
Reference this answer if you’re interested in installing a matplotlib release candidate.