Linux – python symbolic links (also to itself) in usr/bin

linuxpythonpython3symlink

I am currently playing around with cmake a bit and in the process I discovered a few things I don't understand mostly concerning python symbolic links in usr/bin directory:

  1. In my usr/bin directory there exist symbolic links with almost the name of the python executables they point to. It seems to be a while since they were created and I want to know if there could be a reason why this is necessary or if something went wrong at some point and I should delete these symbolic links.

  2. What are the symbolic links pointing to x86_64-linux-gnu-python<x.x>-config* for?

  3. This is more a python specific question: What is the difference between python3.5 and python3.5m?

My usr/bin looks like this:

lrwxrwxrwx  1 root    root           9 Okt 18  2016 python -> python2.7*
lrwxrwxrwx  1 root    root           9 Okt 18  2016 python2 -> python2.7*
-rwxr-xr-x  1 root    root     3546104 Nov 19 10:35 python2.7*
lrwxrwxrwx  1 root    root          33 Nov 19 10:35 python2.7-config -> x86_64-linux-gnu-python2.7-config*
lrwxrwxrwx  1 root    root          16 Dez 10  2015 python2-config -> python2.7-config*
lrwxrwxrwx  1 root    root           9 Okt 18  2016 python3 -> python3.5*
-rwxr-xr-x  2 root    root     4460336 Nov 17 20:23 python3.5*
lrwxrwxrwx  1 root    root          33 Nov 17 20:23 python3.5-config -> x86_64-linux-gnu-python3.5-config*
-rwxr-xr-x  2 root    root     4460336 Nov 17 20:23 python3.5m*
lrwxrwxrwx  1 root    root          34 Nov 17 20:23 python3.5m-config -> x86_64-linux-gnu-python3.5m-config*
lrwxrwxrwx  1 root    root          16 Mär 23  2016 python3-config -> python3.5-config*
lrwxrwxrwx  1 root    root          10 Okt 18  2016 python3m -> python3.5m*
lrwxrwxrwx  1 root    root          17 Mär 23  2016 python3m-config -> python3.5m-config*
lrwxrwxrwx  1 root    root          16 Dez 10  2015 python-config -> python2.7-config*

Best Answer

About the python3.5m, it is the default python.

As it is in the mailing list: https://mail.python.org/pipermail/python-list/2016-June/710983.html

The "m" suffix means that Python is configured "--with-pymalloc", i.e. using specialized mallocs, including the small-object allocator. This is the default configuration. You may also see a "dm" suffix for a build that's configured "--with-pydebug" and "--with-pymalloc".

libpython3.5.so and libpython3.5m.so may actually link to the same shared library:

$ readlink libpython3.5.so
../../x86_64-linux-gnu/libpython3.5m.so.1

$ readlink libpython3.5m.so
../../x86_64-linux-gnu/libpython3.5m.so.1

About the links, they appear normal, it is just moving names and locations around to privide a standard environment for the user; from the links it can be seen the default python is 2.7 and python 3 is linking to 3.5

Related Question