- 用什么:https://stackoverflow.com/questions/62589193/how-to-get-class-diagram-from-python-source-code
- pip install Graphviz报错:https://stackoverflow.com/questions/35205430/pyreverse-complaining-even-after-having-graphviz/50839974#50839974
- 详细指令:https://www.redshiftzero.com/pyreverse-uml/
参考链接1,在pip install pylint
和在文件夹中创建__init__.py
之后,返回上一层目录,执行:pyreverse foldername -o png
;或链接3中的先pyreverse foldername/
生成.dot
文件再dot -Tpng classes.dot -o class_diagram.png
生成png文件。
这时就会报错:
The output format ‘output.png’ is currently not available. Please install ‘Graphviz’ to have other output formats than ‘dot’ or ‘vcg’.
或者
‘Graphviz’ needs to be installed for your chosen output format.
或者
Command ‘dot’ not found
那么此时如果pip install Graphviz
是没用的,还是会报上述错误,解决方法见链接2。需要apt/brew/…安装。如果没有安装权限的话可以在docker下安装。但我懒得搞,直接找了个在线dot2png网站。。。