Проблемы с модулем graphviz в Python - Mac OSX - PullRequest
0 голосов
/ 11 октября 2019

Я получаю следующую ошибку, когда пытаюсь view() файл .dot с модулем graphviz:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/graphviz/backend.py", line 158, in run
    proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in `__init__`
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'dot': 'dot'

Во время обработки вышеуказанного исключения произошло другое исключение:

Traceback (most recent call last):
  File "/Users/user_name/Desktop/New code folder September 7 2019/Introduction to machine learning/ch2_0002.py", line 118, in <module>
    test_cancer_pre_pruning()
  File "/Users/user_name/Desktop/New code folder September 7 2019/Introduction to machine learning/ch2_0002.py", line 109, in test_cancer_pre_pruning
    graphviz.Source(dot_graph).view()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/graphviz/files.py", line 242, in view
    quiet=quiet, quiet_view=quiet_view)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/graphviz/files.py", line 209, in render
    quiet=quiet)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/graphviz/backend.py", line 205, in render
    run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/graphviz/backend.py", line 161, in run
    raise ExecutableNotFound(cmd)
graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'Source.gv'], make sure the Graphviz executables are on your systems' PATH

Я пытался:

  • pip3 установить graphviz
  • conda установить graphviz

И нипохоже, что проблема решается.

...