我通过下载分发文件并运行:
来安装networkxpython setup.py install
它似乎已成功,我在安装
后收到此消息Installed c:\python\python36-32\lib\site-packages\decorator-4.0.11-py3.6.egg
Finished processing dependencies for networkx==1.11
但是当我运行一个非常简单的测试代码时,我会收到错误
import networkx as nx
G=nx.Graph()
print(G.nodes())
print(G.edges())
print(type(G.nodes()))
print(type(G.edges()))
回溯(最近一次调用最后一次):文件“netExample.py”,第3行,in G = nx.Graph()
AttributeError:模块'networkx'没有属性'Graph'
运行print(dr(nx))提供以下属性:
['GraphMLReader','GraphMLWriter',' builtins ','缓存', ' doc ','文件','加载程序','名称','包< /强>”, '路径','规范','例外','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']
答案 0 :(得分:1)
按照以下步骤,它适用于python 3.5
版本。
cd to extracted directory
python setup.py install
pip freeze
netExample.py
文件中。netExample.py
python netExample.py
以下是我得到的输出:
D:\Naveen\so>python netExample.py
[]
[]
<class 'list'>
<class 'list'>
请检查以下内容:
networkx.py
模块之前,检查Windows路径中是否存在任何其他名为networkx
的文件
醇>