mosaic icon indicating copy to clipboard operation
mosaic copied to clipboard

module 'pygments' has no attribute 'formatters'

Open sheng-ri opened this issue 1 year ago • 0 comments

环境

  • Ubuntu 20.04
  • Python 3.10.6
  • pygments 2.15.1
  • 此仓库clone到了~/learn/lib/mosaic

命令

python3 ~/learn/lib/mosaic/mosaic.py hello.py | python3 ~/learn/lib/mosaic/vis/__main__.py

错误信息

Traceback (most recent call last):
  File "/home/abc/learn/lib/mosaic/vis/__main__.py", line 29, in <module>
    formatter=pygments.formatters.html.HtmlFormatter(
AttributeError: module 'pygments' has no attribute 'formatters'

解决

按照网上查询添加这条import可以解决

from pygments.formatters import HtmlFormatter

sheng-ri avatar Jun 27 '23 09:06 sheng-ri