我使用的是Windows 7,Python 3.4.1,Anaconda 2.0.1,Pycharm 3.4。
Graphviz和dot在控制台中工作正常。
但是,当尝试使用pycallgraph时,它会以错误结束。
"C:\Users\John\Anaconda3\python.exe" C:/PycharmProjects/myprojectname/abilities.py
Traceback (most recent call last):
File "C:/PycharmProjects/myprojectname/abilities.py", line 1247, in <module>
with PyCallGraph(output=GraphvizOutput()):
File "C:\Users\John\Anaconda3\lib\site-packages\pycallgraph\pycallgraph.py", line 32, in __init__
self.reset()
File "C:\Users\John\Anaconda3\lib\site-packages\pycallgraph\pycallgraph.py", line 53, in reset
self.prepare_output(output)
File "C:\Users\John\Anaconda3\lib\site-packages\pycallgraph\pycallgraph.py", line 97, in prepare_output
output.sanity_check()
File "C:\Users\John\Anaconda3\lib\site-packages\pycallgraph\output\graphviz.py", line 63, in sanity_check
self.ensure_binary(self.tool)
File "C:\Users\John\Anaconda3\lib\site-packages\pycallgraph\output\output.py", line 97, in ensure_binary
'The command "{}" is required to be in your path.'.format(cmd))
pycallgraph.exceptions.PyCallGraphException: The command "dot" is required to be in your path.
Process finished with exit code 1我能做些什么来解决这个问题呢?
我查了this,但这是给mac的。
发布于 2015-05-15 05:32:03
请确保在path变量中有dot.exe的路径。在计算机属性中,可以转到高级系统设置->高级(选项卡) ->环境变量,然后编辑PATH变量。
确保你的列表中有"C:\Program Files (X86)\Graphviz2.38bin“(我刚刚安装了Graphviz2.38\bin,所以你的路径可能有一点不同)。列表用分号分隔,条目之间不能有空格,也不能有反斜杠。
我的PATH环境变量如下所示:
C:\Users\<censored>\AppData\Roaming\npm;C:\Program Files (x86)\Java\jre7\bin;C:\Program Files (x86)\Graphviz2.38\bin在重新打开windows终端后,我可以运行pycallgraph,如下所示:
C:\Python27\python.exe C:\Python27\Scripts\pycallgraph --stdlib graphviz --output-file=ninja_mol2.png -- script.py "-f SampleDat/blah.txt -s stuff/ -v"这会在我所在的当前工作目录中放置一个很好的PNG。
我希望这能帮到你。
https://stackoverflow.com/questions/26370781
复制相似问题