Score:0

Messed up my ubuntu package manager when trying to tinker with python installs

pk flag

I was trying to get ubuntu (22.04) to point to an install of python 3.11 instead of the default 3.10(stupid, didnt know about virtual envs). Unfortunately this lead me to run the following commands.

sudo rm -f /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python

Now sudo apt update does't work anymore. Is there anyway I can reinstall default python back to usr/bin?

Trying to reinstall python:

sudo apt install python
[sudo] password for juicebox: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However, the following packages replace it:
  2to3 python2-minimal:i386 python2:i386 python2-minimal python2 dh-python python-is-python3

E: Package 'python' has no installation candidate

Sudo apt update call result:

Get:12 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 DEP-11 Metadata [12.9 kB]
Get:13 http://archive.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [41.5 kB]
Get:14 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [18.5 kB]
Fetched 789 kB in 3s (270 kB/s)                        
sh: 1: /usr/lib/cnf-update-db: not found
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

is there anyway I can recover this?

karel avatar
sa flag
The default Python package in Ubuntu 22.04 is named python3-all. I don't why you think you need an obsolete version of Python, but if you need Python 2.7 the way to install it is `sudo apt install python2`
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.