我关注这个文档:https ://mg.pov.lt/objgraph/
objgraph_test.py
:
import objgraph
import os
x = ['a', '1', [2, 3]]
filename = os.path.dirname(__file__) + '/objgraph_test.png'
objgraph.show_refs([x], filename=filename)
当我尝试输出.png
图像文件时,它会引发错误:
(venv) ☁ python-codelab [master] ⚡ python3 /Users/ldu020/workspace/github.com/mrdulin/python-codelab/src/performance-optimization/memory-profile-and-objgraph/objgraph_test.py
Graph written to /var/folders/38/s8g_rsm13yxd26nwyqzdp2shd351xb/T/objgraph-4hy982i9.dot (6 nodes)
Image renderer (dot) not found, not doing anything else
我已经安装了xdot包。
(venv) ☁ python-codelab [master] ⚡ pip3 list | grep -e 'xdot\|objgraph'
objgraph 3.4.1
xdot 1.1
我该如何解决这个问题?