0

Ubuntu (18.0.4) newbie here. I ran

sudo apt install python3.10

in the terminal, only to discover, that python3 was already installed (next to the standard python 2.7). If I now search this most current python3.10 installation via

apt list "python3.*",

I do not find it (only some python3.8 package and older ones). I wanted to keep this installation as clean as possible, but now I do not know where this python installation went. Can I track it and remove it? Do I have multiple versions now? How do I get rid of them?

7
  • 1
    The "standard" python swiched from Py2 to Py3 many years ago, so that statement is confusing. Python 3.10 is not in the Ubuntu repositories yet, so it's unclear what you installed and from what source. Review your /var/log/apt logs to see exactly what was installed and what errored.
    – user535733
    Nov 15, 2021 at 17:58
  • Is there a particular reason you need Python 3.10 vs the 3.6.9 that comes with Ubuntu 18?
    – rtaft
    Nov 15, 2021 at 18:21
  • No, I was just looking for the newest one. I installed Atom and couldnt run a script using f-strings, because (I guess) the script package from Atom was pointing to python2.7. I however assumed, that python3 is not installed at all ...
    – Felix
    Nov 15, 2021 at 18:23
  • 2
    f-strings was introduced in 3.6, so you should be fine there. You can actually have many versions of python installed and switch between them, but you generally want to keep the default python installations alone, as other Ubuntu libraries depend on those versions.
    – rtaft
    Nov 15, 2021 at 18:25
  • @rtaft Yes, that is why I assumed that python3 is missing overall. I did not know that it might be unwise to go for the most current version.
    – Felix
    Nov 15, 2021 at 19:23

2 Answers 2

1

Your system should only have one version of python (2.7) and one version of python3 (3.6) installed for Ubuntu 18. If you wish to install additional versions, you can do it outside of apt by manually downloading it and installing it in its own directory.

There are also tools like pyenv that allow you to manage this. It won't affect the other installations or software that depends on those being there. Different versions can be 'activated' in the current terminal or for specific users.

-3

Open the terminal and try sudo apt purge -y python2.7-minimal ,change the version to any version you want to uninstall.

then run python --version to see what version you have.

11
  • After doing what you recommended, it says: bash; \usr\bin\python: No such file or directory
    – Felix
    Nov 15, 2021 at 18:08
  • 1
    This is potentially really bad advice. If you happen to purge the system installation, things will break since there's a bunch of stuff depending on it.
    – frippe
    Nov 15, 2021 at 18:16
  • 1
    no, if you still have the terminal open from when it was removed, it should list everything else that it removed...usually anything that depends on python2.7-minimal
    – rtaft
    Nov 15, 2021 at 18:26
  • 3
    Yes, however if your stuff still errors then you're facing a reinstall of the entire OS. You should never be altering system level binaries for Python or Python libraries as the OS you're using is dependent on the python that is available in the repos, and is likely to break your OS if you start moving and removing and altering the versions in use.
    – Thomas Ward
    Nov 15, 2021 at 18:26
  • 1
    @Felix, It won't list individual python packages, but you also have /var/log/apt/history.log. This log can be useful to figure out what has been installed or removed recently, in case your system has started acting weird all of a sudden or if you weren't really paying attention when running apt (or simply using -y) etc.
    – frippe
    Nov 15, 2021 at 21:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .