重新安装 Python,但 python 损坏 - 错误的解释器 (Linux Fedora)
所以我正在摆弄不同版本的python,以至于现在我什至无法按照建议此处,并且 python 不起作用。 任何命令上出现的错误实际上是:bash:/usr/bin/dnf:/usr/bin/python3:错误的解释器:权限被拒绝
我确实有python3.7、python3.9和/usr/lib 中的 python3.10 文件夹据我所知状况良好。
我能做些什么?
编辑:我当前的 /usr/bin/python3 指向一个目录而不是可执行文件...这可能是问题吗?
which python3
返回以下内容:
/usr/bin/which: no python3 in (/root/.local/bin:/root/bin:/home/dominik/.local/bin:/home/dominik/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin)
So I was messing around with different versions of python to the extent that now I cannot even do a dnf reinstall python
, as suggested here, and python does not work.
The error which appears on any command really is: bash: /usr/bin/dnf: /usr/bin/python3: bad interpreter: Permission denied
I do have python3.7, python3.9, and python3.10 folders in /usr/lib which as far as I know are in somewhat good condition.
What can I do?
EDIT: my current /usr/bin/python3 points to a directory instead of an executable... could this be the problem?
which python3
returns the following:
/usr/bin/which: no python3 in (/root/.local/bin:/root/bin:/home/dominik/.local/bin:/home/dominik/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如评论中所建议的,下载 dnf 配置使用的确切 rpm 包非常重要。这可以通过
rpm -qa python3
找到。找到并下载此软件包后,使用 rpm -i 命令安装它。成功安装将创建 /usr/bin/python_version 文件夹。对我来说,它是 python3.10,所以 /usr/bin/python3.10。
完成此操作后,删除 /usr/bin/python3 中现有的符号链接,并链接到新创建的 python 版本。
dnf 和 python 现在应该可以工作了。
As suggested in the comments, it is important to download the exact rpm package that dnf is configured to use. This can be found by
rpm -qa python3
.After finding and downloading this package, install it using the rpm -i command. A successful installation will create the /usr/bin/python_version folder. For me, it was python3.10, so /usr/bin/python3.10.
When this is done, remove the existing symlink at /usr/bin/python3, and instead link to the newly created python version.
dnf and python should now work.