【Python】从python项目中自动生成class diagram

  1. 用什么:https://stackoverflow.com/questions/62589193/how-to-get-class-diagram-from-python-source-code
  2. pip install Graphviz报错:https://stackoverflow.com/questions/35205430/pyreverse-complaining-even-after-having-graphviz/50839974#50839974
  3. 详细指令: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网站。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值