tkinter is already part of Python’s standard library and does not need to be installed separately. If you’re facing a ModuleNotFoundError, it suggests that your Python installation might be incomplete or you may be using a version that lacks tkinter. I’ve encountered similar issues with minimal Python distributions. Consider using the Qt5Agg backend instead of TkAgg; you can set this up by adding matplotlib.use('Qt5Agg') after installing PyQt5 via pip install PyQt5. Additionally, you can enable PyCharm’s scientific mode by navigating to Settings > Tools > Python Scientific and checking the corresponding box, which will automatically handle backend configurations and display plots directly within the IDE.
check your pyCharm settings first - go to run configurations and enable “run with python console.” this usually fixes backend issues without touching matplotlib settings. also try running the same code in terminal to see if it’s pyCharm-specific.
Hmm, interesting - what OS are you on? Sometimes this stuff’s OS-specific. Try plt.savefig('test.png') instead of plt.show() to see if matplotlib works at all. That’ll tell us if it’s just a display problem or something worse.