python-3.x 即使在安装后也没有名为“importlib.metadata”的模块

wfsdck30  于 2023-06-07  发布在  Python
关注(0)|答案(1)|浏览(416)

File“/home/username/.local/lib/python3.7/site-packages/kodi_cli.py”,line 3,in import importlib.metadata ModuleNotFoundError:没有名为“importlib.metadata”的模块

pip3 install kodi-cli --user

在索引中查找:https://pypi.org/simplehttps://www.piwheels.org/simple已满足要求:kodi-cli in /home/username/.local/lib/python3.7/site-packages(0.1.9)已满足要求:requests<3.0.0,>=2.28.0 in /home/username/.local/lib/python3.7/site-packages(from kodi-cli)(2.28.1)Requirement already satisfied:urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages(from requests<3.0.0,>=2.28.0->kodi-cli)(1.24.1)Requirement already satisfied:charset-normalizer<3,>=2 in /home/username/.local/lib/python3.7/site-packages(from requests<3.0.0,>=2.28.0->kodi-cli)(2.0.4)Requirement already satisfied:certifici>=2017.4.17 in /usr/lib/python3/dist-packages(from requests<3.0.0,>=2.28.0->kodi-cli)(2018.8.24)Requirement already satisfied:idna<4,>=2.5 in /usr/lib/python3/dist-packages(from requests<3.0.0,>=2.28.0->kodi-cli)(2.6)

kodi-cli -H host -P 8080 -u username -p password -C

我在顶部得到了错误,所以..

pip3 install importlib-metadata --user

在索引中查找:https://pypi.org/simplehttps://www.piwheels.org/simple已满足要求:importlib-metadata in /home/username/.local/lib/python3.7/site-packages(5.0.0)Requirement already satisfied:zipp>=0.5 in /home/username/.local/lib/python3.7/site-packages(from importlib-metadata)(3.10.0)Requirement already satisfied:typing-extensions>=3.6.4; python_version <“3.8”in /home/username/.local/lib/python3.7/site-packages(from importlib-metadata)(3.10.0.0)
仍然得到错误。

python3 --version

简体中文

cat /etc/os-release

PRETTY_NAME=“Raspbian GNU/Linux 10(buster)”NAME=“Raspbian GNU/Linux”VERSION_ID=“10”VERSION=“10(buster)”VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL=”http://www.raspbian.org/“SUPPORT_URL=”http://www.raspbian.org/RaspbianForums“BUG_REPORT_URL=”http://www.raspbian.org/RaspbianBugs“
我在这里挠头。任何帮助将不胜感激。
我怀疑它可能与程序kodi_cli.py中的这段代码有关

import importlib.metadata
import json
import logging
import os
import pathlib
import sys
import textwrap

import version as ver_info
from kodi_interface import KodiObj

__version__ = importlib.metadata.version("kodi-cli")
jtw3ybtb

jtw3ybtb1#

而不是

import importlib.metadata

from importlib_metadata import metadata

如果未安装importlib_metadata模块,则首先通过

pip install importlib-metadata

详细信息:https://stackoverflow.com/a/59734959/19428695

相关问题