"ImportError: cannot import name 'metadata'" when compile libvirt
"ImportError: cannot import name 'metadata'" when compile libvirt
当我从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.
我尝试了一些方法,但没有解决问题
pipenv 从 this
安装 jsonschema==3.0.2
更新 python 版本到 3.8
编译环境:
中心 8; linux 5.14.7; python3.6.8; libvirt 主
尝试更新您的 rst2html5
软件包:
pip install rst2html5
你能试试这个方法吗:
在/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
当我从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.
我尝试了一些方法,但没有解决问题
pipenv 从 this
安装 jsonschema==3.0.2更新 python 版本到 3.8
编译环境: 中心 8; linux 5.14.7; python3.6.8; libvirt 主
尝试更新您的 rst2html5
软件包:
pip install rst2html5
你能试试这个方法吗: 在/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