This is a short python script:
import matplotlib.pyplot as plt import networkx as nx from networkx.drawing.nx_agraph import graphviz_layout G = nx.DiGraph()
You have named your file networkx.py. When importing networkx the local file has precedence over the installed package.
networkx.py
networkx
Just rename your networkx.py and make sure to delete your __pycache__ folder if there is one.
__pycache__