Issue
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 href="https://stackoverflow.com/questions/47879993/how-to-remove-python-3-from-fedora-27-workstation-completely">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)
Solution
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.
ln -s /usr/bin/python3.10 /usr/bin/python3
dnf and python should now work.
Answered By - Cheetaiean Answer Checked By - Clifford M. (WPSolving Volunteer)