Why do I have both /usr/lib/python3 and /usr/lib/python3.8?

Barry Scott barry at barrys-emacs.org
Fri Jan 1 11:35:16 EST 2021



> On 29 Dec 2020, at 15:10, Chris Green <cl at isbd.net> wrote:
> 
> Why are there both /usr/lib/python3 and /usr/lib/python3.8 on my
> x[ubuntu] system?
> 
> /usr/lib/python3 has just the dist-packages directory in it,
> /usr/lib/python3.8 has lots of individual python files in it as well
> as quite a number of directories.  
> 
> There's also a /usr/lib/python3.9 directory even though Ubuntu hasn't
> moved to python3.9 yet.
> 

It is common on linux systems for python3 to be a sym link to the systems preferred
version of python3 to use.

It is also common to be able to install multiple versions of python on a system.
Both older and newer versions.

Usually I use '#!/usr/bin/python3' in my scripts unless I know that a script
has version dependences.

By using python3 you do not have to edit your scripts shebang lines when
your distro updates to a newer version of python.

If you are testing your code against multiple version of python you need the
version specific names like python3.8, python3.10 etc.

Barry

FYI this is what I have installed (lspy is a personal script):

$ lspy
/bin/python: 3.9.1 final 0
/bin/python2: 2.7.18 final 0
/bin/python2.7: 2.7.18 final 0
/bin/python3: 3.9.1 final 0
/bin/python3.10: 3.10.0 alpha 3
/bin/python3.4: 3.4.10 final 0
/bin/python3.5: 3.5.10 final 0
/bin/python3.6: 3.6.12 final 0
/bin/python3.9: 3.9.1 final 0
/bin/python34: 3.4.10 final 0
/bin/python35: 3.5.10 final 0
/usr/bin/python: 3.9.1 final 0
/usr/bin/python2: 2.7.18 final 0
/usr/bin/python2.7: 2.7.18 final 0
/usr/bin/python3: 3.9.1 final 0
/usr/bin/python3.10: 3.10.0 alpha 3
/usr/bin/python3.4: 3.4.10 final 0
/usr/bin/python3.5: 3.5.10 final 0
/usr/bin/python3.6: 3.6.12 final 0
/usr/bin/python3.9: 3.9.1 final 0
/usr/bin/python34: 3.4.10 final 0
/usr/bin/python35: 3.5.10 final 0




More information about the Python-list mailing list