code:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
plt.plot(x, y)
plt.title('Simple Line Plot')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()
Output:
C:\Users\USER\PycharmProjects\Hello\venv\Scripts\python.exe C:\Users\USER\PycharmProjects\Hello\matplot.py
Traceback (most recent call last):
File "C:\Users\USER\PycharmProjects\Hello\matplot.py", line 8, in <module>
plt.plot(x, y)
~~~~~~~~^^^^^^
File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 3794, in plot
return gca().plot(
~~~^^
File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 2742, in gca
return gcf().gca()
~~~^^
File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 1093, in gcf
return figure()
File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 1027, in figure
manager = new_figure_manager(
num, figsize=figsize, dpi=dpi,
facecolor=facecolor, edgecolor=edgecolor, frameon=frameon,
FigureClass=FigureClass, **kwargs)
File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 550, in new_figure_manager
return _get_backend_mod().new_figure_manager(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\backend_bases.py", line 3507, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\backend_bases.py", line 3512, in new_figure_manager_given_figure
return cls.FigureCanvas.new_manager(figure, num)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\backend_bases.py", line 1797, in new_manager
return cls.manager_class.create_with_canvas(cls, figure, num)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\backends\_backend_tk.py", line 483, in create_with_canvas
window = tk.Tk(className="matplotlib")
File "C:\Program Files\Python313\Lib\tkinter\__init__.py", line 2459, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
{C:/Program Files/Python313/lib/tcl8.6} C:/Users/USER/PycharmProjects/Hello/venv/lib/tcl8.6 C:/Users/USER/PycharmProjects/Hello/lib/tcl8.6 C:/Users/USER/PycharmProjects/Hello/venv/library C:/Users/USER/PycharmProjects/Hello/library C:/Users/USER/PycharmProjects/Hello/tcl8.6.14/library C:/Users/USER/PycharmProjects/tcl8.6.14/library
This probably means that Tcl wasn't installed properly.
Process finished with exit code 1
Tried copying the Tcl in the lib folder
Tried installing and reinstalling.
plz help