我下载了 Graphviz 2.38
MSI 版本并安装在文件夹 C:\Python34
下,然后运行了 pip install Graphviz
,一切顺利。在系统路径中我添加了 C:\Python34\bin
。当我尝试运行一个测试脚本时,在代码行 filename=dot.render(filename='test')
,我收到了一条消息。
RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test'], make sure the Graphviz executables are on your systems' path
我试图将"C:\Python34\bin\dot.exe"
添加到系统路径中,但没有成功,我甚至创建了一个名为"GRAPHVIZ_DOT"
的新环境变量,并将其值设置为"C:\Python34\bin\dot.exe"
,但仍然无法正常工作。我尝试卸载Graphviz和pip uninstall graphviz
,然后重新安装并再次使用pip安装,但仍然无效。
完整的回溯消息如下:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\graphviz\files.py", line 220, in render
proc = subprocess.Popen(cmd, startupinfo=STARTUPINFO)
File "C:\Python34\lib\subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Documents\Kissmetrics\curves and lines\eventNodes.py", line 56, in <module>
filename=dot.render(filename='test')
File "C:\Python34\lib\site-packages\graphviz\files.py", line 225, in render
'are on your systems\' path' % cmd)
RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test'], make sure the Graphviz executables are on your systems' path
有人对此有经验吗?