- Установил Graviz на Mac с помощью Brew Install Graviz. См. ниже.
Код: Выделить всё
ls /usr/local/Cellar/graphviz/12.2.1/bin/
acyclic diffimg dot_sandbox graphml2gv gvmap gxl2gv patchwork twopi
bcomps dijkstra edgepaint gv2gml gvmap.sh mm2gv prune unflatten
ccomps dot fdp gv2gxl gvpack neato sccmap
circo dot2gxl gc gvcolor gvpr nop sfdp
cluster dot_builtins gml2gv gvgen gxl2dot osage tred
- Установил пакет Python с помощью pip3 installgraphviz. См. ниже.
Код: Выделить всё
ls /Users/foo/Library/Python/3.7/lib/python/site-packages/graphviz/
__init__.py _tools.py dot.py jupyter_integration.py rendering.py
__pycache__ backend encoding.py parameters saving.py
_compat.py base.py exceptions.py piping.py sources.py
_defaults.py copying.py graphs.py quoting.py unflattening.py
- Переменная PATH также установлена правильно.
Код: Выделить всё
echo $PATH
/usr/local/Cellar/graphviz/12.2.1/bin:/usr/local/opt/curl/bin:/usr/local/opt/curl/bin:
Код: Выделить всё
import json
import graphviz
if __name__ == '__main__':
json_string = '{"192.168.133.166":[{}],"192.168.133.180":[{}],"192.168.133.64":[{}]} '
g1 = graphviz.Digraph(name="my_graph")
data = json.loads(json_string)
if isinstance(data, dict):
for k, v in data.items():
g1.node(k, None)
print(k, v)
# Render the graph
g1.render(filename="my_graph")
Код: Выделить всё
graphviz.backend.execute.ExecutableNotFound: failed to execute PosixPath('dot'), make sure the Graphviz executables are on your systems' PATH
Код: Выделить всё
/usr/local/Cellar/graphviz/12.2.1/bin/dot -T jpeg -O sample.dotПодробнее здесь: https://stackoverflow.com/questions/794 ... ing-on-mac
Мобильная версия