Exception: “dot” not found in path in python on mac

女生的网名这么多〃 提交于 2019-12-20 14:15:14

问题


I want to use caffe.draw to draw the caffe net by anaconda python on mac. But I got the error like this:

File "python/draw_net.py", line 45, in <module>
    main()
  File "python/draw_net.py", line 41, in main
    caffe.draw.draw_net_to_file(net, args.output_image_file, args.rankdir)
  File "/Users/xxh/caffe/distribute/python/caffe/draw.py", line 222, in draw_net_to_file
    fid.write(draw_net(caffe_net, rankdir, ext))
  File "/Users/xxh/caffe/distribute/python/caffe/draw.py", line 204, in draw_net
    return get_pydot_graph(caffe_net, rankdir).create(format=ext)
  File "/Users/xxh/anaconda2/lib/python2.7/site-packages/pydot.py", line 1883, in create
    prog=prog))
Exception: "dot" not found in path.

I have installed pydot and graphviz ,and how can I add the dot's path to python path?


回答1:


If you are still getting the error, I suppose you installed pydot and graphviz using pip. Please use :

  • sudo apt-get install graphviz
  • pip install pydot

If this gives you permission issues please use:

  • sudo pip install pydot

This will install the complete graphviz from Ubuntu.

After this the draw_net.py runs correctly.




回答2:


For me running:

brew install gprof2dot

Fixed the problem.




回答3:


You don't have "dot" install from source http://www.graphviz.org/pub/graphviz/CURRENT/graphviz-working.tar.gz and all works




回答4:


In Mac run:

pip install pydot
brew install gprof2dot



回答5:


I have tried the methods in the above posts but unfortunately none worked for me. dot is an executable file but the problem is that it cannot be found by the system. Finally I managed to fix the problem by

  1. Find the graphviz library in the system. dot should be inside the bin folder.

  2. Either add the graphviz_library/bin into $PATH or create a symbolic link of dot and put it into any folder in $PATH.



来源:https://stackoverflow.com/questions/40243753/exception-dot-not-found-in-path-in-python-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!