AttributeError:'模块'对象没有属性' write_dot'对于networkx库

时间:2017-02-05 08:37:01

标签: python graph networkx dot

我正在使用networkx库来阅读和编写dot图表。根据{{​​3}},write_dot()方法应该是可访问的,但是当我尝试时,

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

我收到以下错误。

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

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:4)

尝试:

{
  "name": "flaschard-app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "babel-preset-es2015": "^6.22.0",
    "babel-preset-react": "^6.22.0",
    "babelify": "^7.3.0",
    "live-server": "^1.2.0",
    "watchify": "^3.9.0"
  },
  "devDependencies": {
    "tern-react": "^0.1.0"
  },
  "scripts": {
    "build": "watchify src/app.js -o public/bundle.js -t [babelify --presets [react es2015]]",
    "server": "cd public; live-server --port=1234 --entry-file=index.html"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

from networkx.drawing.nx_agraph import write_dot