in pyvis I always get this error: "AttributeError: 'NoneType' object has no attribute 'render'"

发布时间 2023-04-17 16:54:23作者: ChuckLu

in pyvis I always get this error: "AttributeError: 'NoneType' object has no attribute 'render'"

Solution

When initializing the Network, I added notebook=True, this fixed the issue for me. The new code is:

from pyvis import network as net
import networkx as nx

#%%
g=net.Network(notebook=True)
nxg = nx.complete_graph(5)
g.from_nx(nxg)

#%%
g.show("example.html")