Python Forum

Full Version: multiple versions of Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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.
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.
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.
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?
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.
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.