问题描述
我下载了Graphviz 2.38
MSI版本,并安装在文件夹C:\Python34
下,然后运行pip install Graphviz
,一切正常.在系统的路径中,我添加了C:\Python34\bin
.当我尝试运行测试脚本时,在filename=dot.render(filename='test')
行中,我收到一条消息
I downloaded Graphviz 2.38
MSI version and installed under folder C:\Python34
, then I run pip install Graphviz
, everything went well. In system's path I added C:\Python34\bin
. When I tried to run a test script, in line filename=dot.render(filename='test')
, I got a message
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安装,但是没有任何效果.
I tried to put "C:\Python34\bin\dot.exe"
in system's path, but it didn't work, and I even created a new environment variable "GRAPHVIZ_DOT"
with value "C:\Python34\bin\dot.exe"
, still not working. I tried to uninstall Graphviz and pip uninstall graphviz
, then reinstall it and pip install again, but nothing works.
整个回溯消息是:
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
有人对此有任何经验吗?
Does anybody have any experience with it?
推荐答案
您应该在系统中安装graphviz软件包(而不仅仅是python软件包).在 Ubuntu 上,您应该尝试:
You should install the graphviz package in your system (not just the python package). On Ubuntu you should try:
sudo apt-get install graphviz
这篇关于"RuntimeError:确保Graphviz可执行文件在系统路径上"安装Graphviz 2.38之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!