I installed networkx by downloading the distribution file and running:
python setup.py install
It appears to have been successful, I got this message after installing
Installed c:pythonpython36-32libsite-packagesdecorator-4.0.11-py3.6.egg
Finished processing dependencies for networkx==1.11
But when I run a really simple test code, I get errors
import networkx as nx
G=nx.Graph()
print(G.nodes())
print(G.edges())
print(type(G.nodes()))
print(type(G.edges()))
> Traceback (most recent call last): File "netExample.py", line 3, in
> <module>
> G=nx.Graph()
> AttributeError: module 'networkx' has no attribute 'Graph'
Running print(dr(nx))
gives the following attributes:
> ['GraphMLReader', 'GraphMLWriter', '__builtins__', '__cached__',
> '__doc__', '__file__', '__loader__', '__name__', '__package__',
> '__path__', '__spec__', 'exception', 'generate_adjlist',
> 'generate_edgelist', 'generate_gexf', 'generate_gml',
> 'generate_graph6', 'generate_graphml', 'generate_multiline_adjlist',
> 'generate_pajek', 'generate_sparse6', 'parse_adjlist',
> 'parse_edgelist', 'parse_gml', 'parse_graph6', 'parse_graphml',
> 'parse_leda', 'parse_multiline_adjlist', 'parse_pajek',
> 'parse_sparse6', 'read_adjlist', 'read_edgelist', 'read_gexf',
> 'read_gml', 'read_gpickle', 'read_graph6', 'read_graphml',
> 'read_leda', 'read_multiline_adjlist', 'read_pajek', 'read_shp',
> 'read_sparse6', 'read_weighted_edgelist', 'read_yaml', 'readwrite',
> 'relabel_gexf_graph', 'utils', 'write_adjlist', 'write_edgelist',
> 'write_gexf', 'write_gml', 'write_gpickle', 'write_graph6',
> 'write_graphml', 'write_multiline_adjlist', 'write_pajek',
> 'write_shp', 'write_sparse6', 'write_weighted_edgelist', 'write_yaml']
See Question&Answers more detail:
os