How to install older Python e.g. 2.7.9

Hi all,

Sorry, been using Linux a while but pretty inexperienced when heading off the beaten path, I’m also not familiar with OpenSUSE, having been using it only a matter of hours. I use X-Plane 11 flight simulator and a particular plugin requires specifically Python 2.7.9 (I know, I know) and I’m trying to install it.

I’ve downloaded the tarball, compiled and installed it to /opt. However I don’t know how to update alternatives. I’ve gone through the alternatives section in YaST2 but Python is not listed as an option. I have Python3 installed (version 3.6.10) but haven’t installed Python2 from the repos as this would be version 2.7.17 I think and I don’t need that for anything else as far as I know.

I’d really appreciate being pointed in the right direction if there’s a guide somewhere or a reply on how to finish the install so the system sees 2.7.9.

If this is a matter of adding it to my path. Can you please let me know the best way to do this is on OpenSUSE.

Thanks very much in advance.
Steve

Hi,
Welcome to openSUSE.

Generally, openSUSE supports only one version of Python (any version) at a time although for short periods of time you might have access to the “next version” by adding the python repository.
Additionally, it seems that current openSUSE policy is to support and implement the Python community’s timetable to deprecate Python 2 and migrate everything to Python 3
This is notwithstanding despite Python’s official policy, they have published an even later version (although truthfully an incremental) new version of Python 2, python 2.8.

Bottom line for openSUSE Users though
Is that you won’t likely find official support for anything related to Python 2…
But you have the remaining option that is also SOP for many distros…
Just install your choice of python from the PyPi repositories9(You can install any number side by side) and use something ly pyenv or the older virtualenv to manage your pythons.

TSU

Hey thanks for the super quick reply TSU! :slight_smile:
How do I add that repository to YaST2 please? I have community and packman repositories added already but can’t see a python or pypi repo to add.

You can install the python management tools pyenv and virtualenv from your default repos.
When you use these management tools, you are then able to access the PyPi repositories using pip and pip3 (they’re the python equivalents of our native zypper and rpm tools).

The pyenv source (github) default page has a good introduction and brief description of the utility. There are other blogs and documentation that describe more extensively and in detail

https://github.com/pyenv/pyenv

The software links to installing pyenv (but you should be able to find and isntall using zypper or YaST Software Manager)

https://software.opensuse.org/package/pyenv

Pyenv is the more modern, recommended tool.
But, some might find the older virtualenv easier to use.

You can again install virtualenv using zypper or YaST Software Manager but here are the software search links

https://software.opensuse.org/package/python-virtualenv
https://software.opensuse.org/package/python3-virtualenv

You shouldn’t have any problems finding articles, documentation and blogs about virtualenv, it’s been around for decades and people have been writing about it all that time. And, it still works if you want to use it.

A brief description is that openSUSE will always have its native python.
But, for a variety of reasons both Developers and Users have had to use apps which are written to a specific Python version.
With the management tools described here, you can install Python from the official Python repositories(not supported by openSUSE) and then specify a specific location (ie directory) where a downloaded Python would be used instead of your system Python.

TSU

Hi
What is the specific plugin? Have you seen this XPPython3 v4.2 now available - X-Plane Developers and Plugins - X-Plane.Org Forum

Hi Malcolm,
Yes, seen that, installed it, it works, but the FSEconomy plugin hasn’t been ported yet. Someone has started the work though.

In other news, thanks again TSE, I managed to get pyenv installed and set up. I copied the Python 2.7 folder (installed from the tarball) from /opt to the pyenv /versions folder. Then used pyenv to set the local version to 2.7.9 and bingo, the plugin is now working and my addiction continues :wink:

Thanks for your help and interest.
Cheers
Steve

Dealing with older versions of installed software can be very tedious and cumbersome. Always check with the vendor whether your application already supports the installed version too.