You are not logged in.

#1 2018-07-23 18:46:06

123John321
Banned
Registered: 2018-07-23
Posts: 3

Python versions in /usr/bin

Hi.

I have these files and folders in /usr/bin:
python, python2, python2.7, python2.7-config, python2-config, python3, python3.6, python3.6-config, python3.6m, python3.6m-conig, python-config.

I wanna use just the newest version of Python.

Can I remove older versions of Python, I think python2, python2.7 and python3.
And which version is just python?

Offline

#2 2018-07-23 18:50:56

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: Python versions in /usr/bin

Not of the files you listed should be binaries.  Most should be symlinks to the latest version.

Offline

#3 2018-07-23 18:58:28

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,720

Re: Python versions in /usr/bin

$ 
$ ls -l $(which python)
lrwxrwxrwx 1 root root 7 Jan  4  2018 /usr/bin/python -> python3
$ ls -l $(which python3)
lrwxrwxrwx 1 root root 9 Jan  4  2018 /usr/bin/python3 -> python3.6
$ ls -l $(which python3.6)
-rwxr-xr-x 2 root root 10024 Jan  4  2018 /usr/bin/python3.6
$ 

On this, needs to updated system, python points at python3.  python3 points at the executable python3.6

Determine of the other interpreters are required for anything you are using using pacman -Qi

$ pacman -Qi python2
Name            : python2
Version         : 2.7.14-2
Description     : A high-level scripting language
Architecture    : x86_64
URL             : http://www.python.org/
Licenses        : PSF
Groups          : None
Provides        : None
Depends On      : bzip2  gdbm  openssl  zlib  expat  sqlite  libffi
Optional Deps   : tk: for IDLE
                  python2-setuptools [installed]
                  python2-pip
Required By     : asciidoc  libkate  mercurial  python2-appdirs  python2-cairo  python2-gobject2  python2-pyparsing
                  python2-six  smbclient  volume_key
Optional For    : alsa-lib  boost  clang  git  ldb  libevent  libglade  libproxy  talloc  tdb  tevent  texlive-core
                  texlive-music  usbutils  vim
Conflicts With  : python<3
Replaces        : None
Installed Size  : 72.44 MiB
Packager        : Felix Yan <felixonmars@archlinux.org>
Build Date      : Thu 04 Jan 2018 06:42:53 PM PST
Install Date    : Tue 27 Mar 2018 07:16:01 AM PDT
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

$ 

Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#4 2018-07-23 19:12:14

123John321
Banned
Registered: 2018-07-23
Posts: 3

Re: Python versions in /usr/bin

Thanks.

So packages in Required By needs python2 and packages in Optional For should they have it, but not necessarily?

And why so many links (python to python3 and python3 to python3.6)?
Why is there not only a python or python3.6?

Last edited by 123John321 (2018-07-23 19:13:59)

Offline

#5 2018-07-23 19:31:09

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: Python versions in /usr/bin

The link from python to python3 is provided by the arch package (from when arch transitioned from python2 to python3 providing python)
The python3 to python 3.6 link and python3.6m being hardlinked python3.6 is from the upstream Makefile I believe.
Edit:
clarify python3.6m to python3.6 is a hardlink.

Last edited by loqs (2018-07-23 19:41:15)

Offline

#6 2018-07-23 19:40:21

123John321
Banned
Registered: 2018-07-23
Posts: 3

Re: Python versions in /usr/bin

Sorry, but I do not understand.

When python3.6m is the identical binary to python3.6, can I delete it?

Offline

#7 2018-07-23 19:43:00

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: Python versions in /usr/bin

It is a hardlink so takes no practical space and is provided by the package as arch follows upstream's wishes so I would strongly suggest leaving it alone.

Offline

#8 2018-07-23 20:08:07

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,720

Re: Python versions in /usr/bin

Scripts may ask for python, python2, python3, etc...  If a script wants python, the chain of links eventually gets you to python3.6.  Same if a script asks for python3.  If 3.6 changes to 3.7 in the future, scripts asking for python 3 will still work.
Also, if a script asks for python2 (knowing it won't work with 3), then the python2 will lead to the installed version of 2; whether it is 2.6. 2.7, etc...
If a script asks for a specific version , such as 3.6, it will stop working if the installed version changes to 3.7.  (Actually, it would probably block the upgrade)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB