如何在Spyder 3.6中安装GraphViz

时间:2017-03-23 03:39:50

标签: python spyder

我见过一个Stack Overflow存储库,并且在那里提到首先'pip install GraphViz'然后'pip install pydotplus'。现在我已经成功安装了我的C:\ Users \ ChirantanGupta \ Downloads \ WinPython-64bit -3.6.0.0 \蟒蛇,3.6.0b3.amd64 \ LIB \站点包。两者都存在于那里,但每当我尝试运行此代码时,它都会显示错误: 错误是:

文件“C:\ Users \ ChirantanGupta \ Downloads \ WinPython-64bit-3.6.0.0 \ python-3.6.0b3.amd64 \ lib \ site-packages \ pydotplus \ graphviz.py”,第1918行,写入     fobj.write(self.create(prog,format))

文件“C:\ Users \ ChirantanGupta \ Downloads \ WinPython-64bit-3.6.0.0 \ python-3.6.0b3.amd64 \ lib \ site-packages \ pydotplus \ graphviz.py”,1960年的行,在创建     '未找到GraphViz的可执行文件')

InvocationException:找不到GraphViz的可执行文件

以下是代码:

[Tree('S', [Tree('S', [Tree('V', ['describe']), Tree('NP', [Tree('DT', ['every']), Tree('N', ['step']), Tree('PP', [Tree('P', ['of']), Tree('NP', [Tree('PRP', ['your']), Tree('N', ['work'])])])])]), Tree('CONJ', ['and']), Tree('S', [Tree('V', ['present']), Tree('NP', [Tree('DT', ['all']), Tree('NP', [Tree('ADJ', [Tree('ADJ', ['intermediate']), Tree('CONJ', ['and']), Tree('ADJ', ['final'])]), Tree('N', ['results']), Tree('PP', [Tree('P', ['in']), Tree('NP', [Tree('DT', ['a']), Tree('N', ['Word_Document'])])])])])])])]

2 个答案:

答案 0 :(得分:1)

要在WinPython中安装Graphviz:

  1. 确保已安装Graphviz可执行文件。如果不是,请转到Graphviz download page,下载Windows二进制文件并将其安装到所需的位置。例如,假设安装后的Graphviz根目录为c:\tools\graphviz
  2. 确保将Graphviz bin子文件夹添加到您的PATH环境变量中。按照示例,打开命令提示符窗口,然后键入:

    setx PATH=%PATH%;c:\tools\graphviz\bin;
    
  3. 使用graphviz或WinPython软件包管理器在WinPython中安装pip软件包(有关更多详细信息,请参见here)。

  4. 通过运行Graphviz hello.py示例来测试所有组件是否正常工作。

答案 1 :(得分:0)

也许试试这个:

  • 找到" python._pth"文件旁边" \ WinPython-64bit-3.6.0 .0 \ python-3.6.0b3.am d64 \ python.exe"
  • 将其重命名为" zpython._pth"