gpt4 book ai didi

python - 模块未找到错误 : No module named 'dnf' when running yum or dnf

转载 作者:行者123 更新时间:2023-12-05 01:41:42 87 4
gpt4 key购买 nike

几天前我想运行dnf但是我收到了以下错误

Traceback (most recent call last):
File "/usr/bin/dnf", line 57, in <module>
from dnf.cli import main
ModuleNotFoundError: No module named 'dnf'

因此我尝试运行 yum 并收到类似的信息:

Traceback (most recent call last):
File "/usr/bin/yum", line 57, in <module>
from dnf.cli import main
ModuleNotFoundError: No module named 'dnf'

我不知道发生了什么,我希望有人能帮我找到问题并解决它。我唯一知道的是,这可能与我前几天使用conda在python中安装tensorflow有关。尽管 conda 现在似乎不起作用,因为我明白了:

Traceback (most recent call last):
File "/usr/bin/conda", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3126, in <module>
@_call_aside
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3110, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3139, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 581, in _build_master
ws.require(__requires__)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 898, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 784, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'conda==4.5.11' distribution was not found and is required by the application

我使用的是软呢帽29谢谢!

最佳答案

我遇到了同样的问题,但经过反复试验,唯一真正起作用的是:

rpm -qa python3

这将公布您的 python3 rpm 包。

我已经从网上搜索并下载了它

转到下载的目录,如:

sudo rpm -e --nodeps python3-3.7.2-4.fc29.x86_64(my python3 rpm package)
sudo rpm -i python3-3.7.2-4.fc29.x86_64.rpm

我尝试了许多其他方法,所以这不是解决该问题的唯一因素。

关于python - 模块未找到错误 : No module named 'dnf' when running yum or dnf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53894712/

87 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com