0

I'm missing the python3 binary in /usr/bin/.

which python3 outputs /home/d4rkc10ud/anaconda3/bin/python3

sudo apt install python3 outputs python3 is already the newest version (3.12.3-0ubuntu1).

sudo apt install python3-dev outputs python3-dev is already the newest version (3.12.3-0ubuntu1).

A python3 file exists in /usr/local/bin that links to a python3.12 file in the same directory.

I'm running Kubuntu 24.04 on my machine. I'd really appreciate any help.

UPDATE:

file /usr/bin/python3 outputs /usr/bin/python3: broken symbolic link to python3.12

Maybe creating a symbolic link from /usr/bin/python3 to /usr/local/bin/python3.12 would help? I'm fairly new to linux so I'm afraid to just try it and mess things up more.

2
  • please don't start making such symlinks, out of guessing. Before you were using anaconda, did you manually install any python things system-wide, any other way than with apt? It's not usual that a python installation gets so messed up, so we're really left to wonder whether you'd have any idea what could have caused this. Commented Jul 31, 2024 at 9:03
  • for example, there really should not be a python3 in /usr/local – that points to your installing a non-packaged python. When did that happen? Commented Jul 31, 2024 at 9:04

1 Answer 1

2

You need to reinstall python3-minimal, after cleaning things up:

sudo rm -f /usr/bin/python3 /usr/bin/py3compile
sudo apt reinstall python3-minimal

Since the /usr/bin/python3 symlink is broken, you also need to reinstall python3.12-minimal:

sudo apt reinstall python3.12-minimal
6
  • 1
    That returns the following error: E: Internal Error, No file name for python3-minimal:amd64 I tried running sudo apt install python3-minimal and that py3compile: not found. py3compile seems to depend on the missing #! /usr/bin/python3 file. Commented Jul 31, 2024 at 8:12
  • @MedhanshGarg this sounds a bit like you're running sudo apt… from within an conda environment. don't do that. Commented Jul 31, 2024 at 9:00
  • @MedhanshGarg you should remove the dangling symlink first, at least; see the updated answer. Commented Jul 31, 2024 at 9:32
  • I tried running the command outside the conda environment after running conda deactivate, still the same issues. I ran the rm command that you suggested. That seemed to remove the symlink and the py3compile file. I then ran the second command which threw an error saying E: Internal Error, No file name for python3-minimal:amd64. So I tried sudo apt install python3-minimal which seemed to run without any errors but it didn't seem to install python3. So I then retried the reinstall command which recreated the py3compile file and the broken symlink. Commented Jul 31, 2024 at 11:05
  • Should I try ./configure --prefix=/usr --enable-optimizations to install python from source into /usr/bin/? Commented Jul 31, 2024 at 11:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.