Python Forum
many versions on python on linux - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: many versions on python on linux (/thread-5678.html)



many versions on python on linux - Skaperen - Oct-16-2017

i would like to setup as many installed versions of python under linux as possible without chroots, containers or virtual machines.  anyone know how (even if only for a specific distro)?


RE: many versions on python on linux - wavic - Oct-16-2017

Perhaps you could just do sudo apt install  python3.5 python3.6. The second should not (edited) replace the first or already installed version.
The other way is to install it from source but instead of make install do make altinstall


RE: many versions on python on linux - Skaperen - Oct-16-2017

i want to have at least python2.6 python2.7 python3.4 python3.5 python3.6 on concurrently, more if available.  i have found that these versions are available on amazon linux.  a version that can't be found is ok not to have, but the 5 i list are available at least for that one distro, which is based on centos.


RE: many versions on python on linux - sjdv1982 - Oct-16-2017

If you are on Ubuntu/Mint, there you could look for a multi-Python-version PPA on Launchpad. I found one a year or two ago and it worked for me, not sure if it is still maintained.


RE: many versions on python on linux - wavic - Oct-16-2017

Hm, I didn't think that different versions maybe can't be found in the repository. Compiling them with 'make altinstall' seems the easier for me. I am using Arch Linux from a half an year regardless that I have Ubuntu MATE and Mint on other partitions.


RE: many versions on python on linux - metulburr - Oct-16-2017

Quote:i would like to setup as many installed versions of python
You are not limited to whatever that linux distro's repo has available. You can just download every python version you want from python.org and compile them from source. In theory you can have every single version ever built if you really wanted to.

After you download each python version, change directory to that download directory and execute
./configure
make
and there will be a python executable named python for that version downloaded in that directory. And you just repeat the process with every version you want. And to run that version ./python if your in that directory, otherwise the path to that directory.

I can honestly say, that most linux users would just build it from source as they do with everything else.


RE: many versions on python on linux - snippsat - Oct-16-2017

Use pyenv,which make it easy to install and change between versions.
I have a tutorial here.

Example run:
mint@mint ~ $ pyenv install 3.6.2
Downloading Python-3.6.2.tar.xz...
-> https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
Installing Python-3.6.2...
Installed Python-3.6.2 to /home/mint/.pyenv/versions/3.6.2
 

# Make python and pip default to 3.6.2 or what version want to use
mint@mint ~ $ pyenv global 3.6.2
 
# Check what's available
mint@mint ~ $ pyenv install --list 
# here will list all version available from 2 to 3,Anaconda,PyPy...ect.
 
# Install the version you desire
mint@mint ~ $ pyenv install anaconda-x.x.x
 
# If just want test out Anaconda is a shell session.
pyenv shell anaconda-x.x.x
 
# It's safe don't mess with OS python 
# Can always go back to system default
mint@mint ~ $ pyenv local system
mint@mint ~ $ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
mint@mint ~ $ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>



RE: many versions on python on linux - DeaD_EyE - Oct-16-2017

I use also pyenv everywhere. The most time I'm just using the latest version of Python.
If you have all build-dependencies, it's very easy to install many different versions and switching between them.


RE: many versions on python on linux - Skaperen - Oct-17-2017

i don't build from source anymore, unless i need to.  this ubuntu i am running currently is all installed from ubuntu packages (or some from pip).  compiling might be an option, for this.  the versions i want is just a reasonable set of what my code may encounter.  this so i can test it in these cases.

i already can run 2.6, 2.7, 3.4, 3.5, 3.6 on amazon linux in separately launched instances on AWS.  that might be good enough for testing python code that is not distro specific.