“RuntimeError: Make sure the Graphviz executables are on your system's path” after installing Graphviz 2.38

后端 未结 29 2241
感动是毒
感动是毒 2020-12-02 06:00

I downloaded Graphviz 2.38 MSI version and installed under folder C:\\Python34, then I run pip install Graphviz, everything went well.

相关标签:
29条回答
  • 2020-12-02 06:06

    On Ubuntu Linux this solved it for me:

    pip install graphviz
    sudo apt-get install graphviz
    

    You could also try conda install -c conda-forge graphviz instead of pip if using Anaconda.

    0 讨论(0)
  • 2020-12-02 06:06

    OS Mojave 10.14., Python 3.6

    Using pip install graphviz had good feedback in terminal, but lead to this error when I tried to make a graph in a Jupyter notebook. I then ran brew install graphviz, which gave an error in terminal. Then I ran conda install graphviz and the graph worked.

    From @Leighton's comment: pip only gets path problem same as yours and conda only gets import error.

    0 讨论(0)
  • 2020-12-02 06:09

    Add graphviz to the System Path

    1. Windows - Edit the System Environment Variables.
    2. Choose Environment Variables.
    3. Select Path - New
    4. Add the Path of graphviz

    Ex: C:\Users\AppData\Local\Continuum\anaconda3\Library\bin\graphviz

    0 讨论(0)
  • 2020-12-02 06:10

    Try conda install graphviz. I had the same problem, I resolved it by mentioned command in MacOS.

    0 讨论(0)
  • 2020-12-02 06:10

    After you've installed the package (link if you haven't), add the path to dot.exe as a new system variable.

    Default path is:

    C:\Program Files (x86)\Graphviz2.38\bin\dot.exe

    0 讨论(0)
  • 2020-12-02 06:10

    For Linux users who don't have root access and hence can't use sudo command as suggested in other answers...

    First, activate your conda virtual-environment (if you want to use one) by:

    source activate virtual-env-name
    

    Then install graphviz, even if you have already done it using pip:

    conda install graphviz
    

    then copy the result of the following command:

    whereis dot
    

    In my case, its output is:

    /home/nader/anaconda2/bin/dot
    

    and add it to your PATH variable. Just run the command below

    nano ~/.bashrc
    

    and add these lines to the end of the opened file:

    PATH="/home/username/anaconda2/bin/dot:$PATH"
    export PATH
    

    now press Ctrl+O and then Ctrl+X to save and exit.

    Problem should be solved by now.

    Pycharm users, please note: Pycharm does not always see the PATH variable the same as your terminal. This solution does not work for Pycharm, and maybe other IDEs. But you can fix this by adding this line of code:

    os.environ["PATH"] += os.pathsep + '/home/nader/anaconda2/bin'
    

    to your python program. Do not forget to

    import os
    

    first :)

    Edit: If you don't want to use conda, you can still install graphviz from here without any root permissions and add the bin folder to your PATH variable. I didn't test this.

    0 讨论(0)
提交回复
热议问题