#python #pydot
#python #pydot
Вопрос:
вчера я добавил пакет pydot, установив его через pip в командной строке. Я могу импортировать пакет и даже создать объект, но когда я хочу создать график с помощью:
graph.write_jpg('example1_graph.jpg')
Я получаю следующую ошибку:
Exception: "dot.exe" not found in path.
Комментарии:
1. Какую ОС вы используете?
2. Windows 7 Enterprise 64
Ответ №1:
Попробуйте вручную добавить папку Graphviz bin в свой системный путь.
>>> import pydot
>>> pydot.find_graphviz()
{'dot': 'C:\Program Files (x86)\Graphviz 2.28\bin\dot.exe'} #...
>>> print pydot.find_graphviz.__doc__
"""
Locate Graphviz's executables in the system.
Tries three methods:
First: Windows Registry (Windows only)
This requires Mark Hammond's pywin32 is installed.
Secondly: Search the path
It will look for 'dot', 'twopi' and 'neato' in all the directories
specified in the PATH environment variable.
Thirdly: Default install location (Windows only)
It will look for 'dot', 'twopi' and 'neato' in the default install
location under the "Program Files" directory.
It will return a dictionary containing the program names as keys
and their paths as values.
If this fails, it returns None.
"""
Комментарии:
1. Привет, спасибо за ответ. Однако у меня есть проблема при выполнении:
2. Ошибка атрибута: модуль ‘pydot’ не имеет атрибута ‘find_graphviz’
3. В версии pydot 1.2.x функция find_graphviz устарела. Чтобы устранить эту проблему, вы можете установить версию pydot 1.1.0 здесь github.com/erocarrera/pydot/tree/v1.1.0