简体   繁体   English

AttributeError:'module'对象没有networkx库的属性'write_dot'

[英]AttributeError: 'module' object has no attribute 'write_dot' for networkx library

I am using networkx library for reading and writing dot graphs. 我正在使用networkx库来读写dot图。 According to the documentation here , write_dot() method should be accessible, however when I try, 根据此处文档write_dot()方法应该可以访问,但是当我尝试时,

>>> import networkx
>>> networkx.write_dot(graph,fileName)

I get the following error. 我收到以下错误。

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'write_dot'

How can I solve this? 我该如何解决?

Try: 尝试:

from networkx.drawing.nx_agraph import write_dot

or 要么

 from networkx.drawing.nx_pydot import write_dot

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM