Форум сайта python.su
Вот сам код:
import matplotlib.pyplot as plt
import networkx as nx
G = nx.Graph()
nodes =
edges =
G.add_nodes_from(nodes)
G.add_edges_from(edges)
nx.draw(G, with_labels=True, font_weight='bold')
plt.show()
А вот ошибки, которые он мне выдаёт
error reading package index file CUsers/chesn/AppData/Local/Programs/Python/Python311/tcl/tk8.6/pkgIndex.tcl: invalid command name “ ”
Traceback (most recent call last):
File “C:\Users\chesn\PycharmProjects\pythonProject\main.py”, line 9, in <module>
nx.draw(G, with_labels=True, font_weight='bold')
File “C:\Users\chesn\PycharmProjects\pythonProject\venv\Lib\site-packages\networkx\drawing\nx_pylab.py”, line 108, in draw
cf = plt.gcf()
^^^^^^^^^
File “C:\Users\chesn\PycharmProjects\pythonProject\venv\Lib\site-packages\matplotlib\pyplot.py”, line 906, in gcf
return figure()
^^^^^^^^
File “C:\Users\chesn\PycharmProjects\pythonProject\venv\Lib\site-packages\matplotlib\_api\deprecation.py”, line 454, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\chesn\PycharmProjects\pythonProject\venv\Lib\site-packages\matplotlib\pyplot.py”, line 840, in figure
manager = new_figure_manager(
^^^^^^^^^^^^^^^^^^^
File “C:\Users\chesn\PycharmProjects\pythonProject\venv\Lib\site-packages\matplotlib\pyplot.py”, line 384, in new_figure_manager
return _get_backend_mod().new_figure_manager(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\chesn\PycharmProjects\pythonProject\venv\Lib\site-packages\matplotlib\backend_bases.py”, line 3574, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\chesn\PycharmProjects\pythonProject\venv\Lib\site-packages\matplotlib\backend_bases.py”, line 3579, in new_figure_manager_given_figure
return cls.FigureCanvas.new_manager(figure, num)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\chesn\PycharmProjects\pythonProject\venv\Lib\site-packages\matplotlib\backend_bases.py”, line 1742, in new_manager
return cls.manager_class.create_with_canvas(cls, figure, num)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\chesn\PycharmProjects\pythonProject\venv\Lib\site-packages\matplotlib\backends\_backend_tk.py”, line 483, in create_with_canvas
window = tk.Tk(className=“matplotlib”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\chesn\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py”, line 2326, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: Can't find a usable tk.tcl in the following directories:
CUsers/chesn/AppData/Local/Programs/Python/Python311/tcl/tcl8.6/tk8.6 CUsers/chesn/AppData/Local/Programs/Python/Python311/tcl/tk8.6 CUsers/chesn/AppData/Local/Programs/Python/lib/tk8.6 CUsers/chesn/AppData/Local/Programs/Python/lib/tk8.6 CUsers/chesn/AppData/Local/Programs/lib/tk8.6 CUsers/chesn/AppData/Local/Programs/Python/library
CUsers/chesn/AppData/Local/Programs/Python/Python311/tcl/tk8.6/tk.tcl: invalid command name “ ”
invalid command name “ ”
while executing
“ …”
(file “CUsers/chesn/AppData/Local/Programs/Python/Python311/tcl/tk8.6/msgs/ru.msg” line 1)
invoked from within
“::source -encoding utf-8 CUsers/chesn/AppData/Local/Programs/Python/Python311/tcl/tk8.6/msgs/ru.msg”
(in namespace inscope “::tk::msgcat” script line 1)
invoked from within
"namespace inscope $ns
Офлайн