Python Forum
multiple versions of Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiple versions of Python
#1
when i compile a different version of Python from source and try to install it, will i try to replace any file of the existing version? or will it keep each version separate? this is on Ubuntu Linux 16.04.6 which has /usr/bin/python3.5 (not /usr/bin/python3.5.2). does do this naming scheme only with the major,minor numbers and avoid the bugfix numbers?
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
You can configure it to do what you want, I'm not sure what the default is.
I would just use pyenv for installing multiple versions.
Reply
#3
apparently pyenv creates an "environment" of some kind in a subdirectory and you have to activate it in each shell session. but you cannot have 2 or more concurrent activations. checking each script to see what version it uses then activating that version is not a practical way to use scripts. environments is not the way to go for what i am planning to do. basically, i need to have each version in /usr/bin and other system directories. i do have 2 versions now and can use either one by just specifying which version in the #! line (the first line) of the script.

i'm still trying to find out what kind of environment pyenv creates so i can evaluate how it might be made usable. who here really knows? this is on Ubuntu Linux 16.04.6.
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
It basically creates a whole new installation in a folder.

It then gives you the ability to choose which executables python and pip (maybe others as well?) refer to.
This can be chosen both globally and for a single directory (and subdirectories).

There are more details on github.

AFAICT shebangs should work as expected.
Reply
#5
what does "whole new installation in a folder" really mean for this? is it just those files or is it a container? can i chroot into their and run everything on that version?

i'm not going to hunt around on github.

how does env find pythonX in the folder?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#6
You can see it on the syscalls, if you start python with strace.
The place of the binary is the starting point. Then Python tries all relative
known paths to open the resources.

Here the stacktrace:

Aditionally command line parameters and environment variables define which paths the Python interpreter is using.
You have the same behaviour with virtual environments. In the case the difference is, that the files are symlinks.
Pyenv downloads Python from github, compiles it and installs it.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#7
how does it get to .pyenv/versions/3.7.3/bin/python at the start? my scripts will have #!/usr/bin/env python3.7 or the like. does this set up a symlink at /usr/bin/python3.7? it might be possible that a script has #!/usr/bin/python3.7.

and i already have every version of source. no need to download again. but, at least compiling should make it work on ARM64 architectures.
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
  Python App On Different Versions Harshil 3 2,295 Aug-25-2020, 04:14 PM
Last Post: snippsat
  compiling various versions of Python, which toolchain? Skaperen 4 2,669 Jun-06-2019, 06:28 AM
Last Post: Skaperen
  running other older versions of python Skaperen 20 9,724 Mar-03-2018, 02:23 AM
Last Post: Skaperen
  many versions on python on linux Skaperen 8 5,678 Oct-17-2017, 02:22 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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