Python 2.7 instead of python 3?

I post this in applications although it could be a “scripting” question as well, but let’s see.
I have a Tumbleweed as you can see from the tag.

I wanted to check a couple of python libraries and to my surprise, system python is set to 2.7!

So, why is this the case? Do we have a document/howto on how to get rid it and move everything to python 3.10/11/whatever?

1 Like

I am not sure what do you call “system python”.

The binary python always refers to the Python 2.x. To use Python 3.x you need to use binary python3. This is upstream decision.

Some components may still have a dependency on Py2. Check for that.

Some folks (cough) have been known to create an alias, so any arcane component that wants py2 will be pointed to / serviced by py3. Test first, before moving forward.

Do you actively use Py yourself? Or did you make this discovery purely by accident ?

On my tumbleweed system:

$ which python
which: no python in $PATH
$ which python3
/usr/bin/python3

I did a fresh install about a 5 6 weeks ago and I did actively clean up python310* packages using zypper as I saw a mix of python310 and python311 likely because I did install some python310* I use and that are not part of the default install.

I saw already the first python312 popping up :wink:

I did the same cleanup an hour ago with both my primary and secondary desktops. ( not a reinstall, but cleanup of py stuff).

Shocked at how many duplicates there were for py310 and py311.

Basically, I did a …

zypper remove --dry-run python310*

… first to test for potential side effects. No prob, so ran it for real. Did this on the secondary machine, rebooted, tested, etc… then jumped to the primary and did the same there.
.
.
I also checked for “package conflict” for any rogue packages in Packman… only a couple that were satisfied in a standard repo … so was finally able to remove any dependency on Packy.

2 Likes

I just did that on the laptop - worked like a charm !! Thanks for the tip.

Hello, this is Gulshan Negi
Well, if you want to transition to Python 3.x and utilize the latest Python libraries, you can follow the steps outlined below:

  1. Install Python 3 using the package manager.
  2. Establish a virtual climate utilizing the venv module to segregate your Python projects.
  3. To use Python 3, activate the virtual environment.
  4. Introduce Python libraries utilizing pip inside the virtual climate.
  5. Make changes to any applications or scripts so that they use Python 3 in the shebang line.
  6. Make sure your code is compatible with Python 3 by testing and migrating it.

Thanks