Python Forum
many versions on python on linux
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
many versions on python on linux
#1
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)?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
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
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
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.
Reply
#5
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.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#6
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.
Recommended Tutorials:
Reply
#7
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.
>>>
Reply
#8
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.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#9
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas + PIL on Linux (Python 32) Clives 3 2,110 Mar-25-2022, 07:46 PM
Last Post: snippsat
  Python App On Different Versions Harshil 3 2,352 Aug-25-2020, 04:14 PM
Last Post: snippsat
  multiple versions of Python Skaperen 6 2,937 Jun-13-2019, 12:32 AM
Last Post: Skaperen
  compiling various versions of Python, which toolchain? Skaperen 4 2,719 Jun-06-2019, 06:28 AM
Last Post: Skaperen
  running other older versions of python Skaperen 20 9,922 Mar-03-2018, 02:23 AM
Last Post: Skaperen
  how to install python on linux manchun 5 4,522 Mar-01-2018, 09:09 AM
Last Post: wavic
  Which is best for python?Linux or windows? PySoD 21 32,967 Jun-19-2017, 04:52 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020