python3.10 -m pip install --user matplotlib
I keep getting the following error when I run the above to install Matplotlib. I was initially getting a C++ error and I installed Visual Studio.
Time Elapsed 00:00:00.36 error: command 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe' failed with exit code 1 ---------------------------------------- ERROR: Command errored out with exit status 1: 'C:UsersHPAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\HP\AppData\Local\Temp\pip-install-zq_i4lrq\matplotlib_ce44358747c74e83a93eefbdd122f13e\setup.py'"'"'; __file__='"'"'C:\Users\HP\AppData\Local\Temp\pip-install-zq_i4lrq\matplotlib_ce44358747c74e83a93eefbdd122f13e\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersHPAppDataLocalTemppip-record-yvrkad5minstall-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:UsersHPAppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310Includematplotlib' Check the logs for full command output.
Advertisement
Answer
Matplotlib doesn’t support Python 3.10 at the moment, so you have the following options.
- See this answer for detailed instructions to downgrade to Python 3.9.
- Install the pre-release version of Matplotlib which does support Python 3.10. This can be done with the command
pip install matplotlib==3.5.0rc1
(and is what I would recommend doing).