编译 libvirt 时"ImportError: cannot import name 'metadata'"



当我从github编译libvirt代码时,有以下错误:

[395/1071] Generating 'docs/committer-guidelines.html.p/committer-guidelines.html.in'.
FAILED: docs/committer-guidelines.html.p/committer-guidelines.html.in
/usr/bin/meson --internal exe --capture docs/committer-guidelines.html.p/committer-guidelines.html.in -- /usr/local/bin/rst2html5 --stylesheet= --strict ../docs/committer-guidelines.rst
Traceback (most recent call last):
File "/usr/local/bin/rst2html5", line 7, in <module>
from rst2html5_ import main
File "/usr/local/lib/python3.6/site-packages/rst2html5_.py", line 17, in <module>
from rst2html5 import HTML5Writer  # noqa E402
File "/usr/local/lib/python3.6/site-packages/rst2html5/__init__.py", line 4, in <module>
from importlib import metadata
ImportError: cannot import name 'metadata'
[422/1071] Compiling C object src/conf/libvirt_conf.a.p/domain_conf.c.o
ninja: build stopped: subcommand failed.

我试了几种方法,但都解决不了问题

  1. pipenv安装jsonschema = = 3.0.2从这个

  2. 更新python版本到3.8

编译环境:centos 8;linux 5.14.7;python 3.6.8;libvirt主要

你可以试试这个方法吗?/usr/local/lib/python3.6/site-packages/rst2html5/init. py修改:

try:
from importlib import metadata
except ImportError:
# Running on pre-3.8 Python; use importlib-metadata package
import importlib_metadata as metadata  # type: ignore

https://gitlab.com/meltano/sdk/-/issues/58

尝试更新您的rst2html5包:

pip install rst2html5

相关内容

  • 没有找到相关文章

最新更新