why is there more than one python 2 command in ubuntu 12.04?

Ramon Martinez

so while playing with some aliases I realized that there are three python commands (without taking into account the python 3 commands) in the terminal:

  • python
  • python2
  • python2.7

So my question is why is this the case? Why do we need three? I understand the need to have a generic one (python) and the need to have another one to distinguish python3 from python2 but the rest I do not know.

Furthermore, how can I see if they are linked to the same file (symbolic link)?

Rmano

python is the default interpreter used by the distribution. It may (or may not1) point to python3 in the future.

python2 is the default Python 2 interpreter (that is the same as above if python points to python2, not otherwise). It points to the current stable/supported interpreter.

python2.7 is the specific interpreter --- you can have for example python2.7 as the current one, and a python2.1 that you need to check compatibility matters.

To see all of them:

[romano:~] % ls -l /usr/bin/python /usr/bin/python2 /usr/bin/python2.7
lrwxrwxrwx 1 root root       9 jul 22  2014 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root       9 jul 22  2014 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3345416 jun 22 20:51 /usr/bin/python2.7

So in your scripts — in the shebang2 — you use python if you want to use the default interpreter for the distribution (and if you want total future safety you have your script both working in version 2 and 3, but see note 1 below); python2 or python3 if you need version 2 or 3 specifically, but it's ok using the default one the distribution offers (recommended); python2.7 if you need that specific version and you prefer that your script fails if it's not available.


1 I think it will never change to point to python3, it's too dangerous. But well, I have no crystal balls...

2 this is the first line of the executable scripts that for Python should look like

#! /usr/bin/env python2

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Bash: more than one command line substitution

From Dev

Bash Script execute more than one command

From Dev

Bash: more than one command line substitution

From Dev

Running more than one command with xargs

From Dev

Sort command on more than one field

From Dev

Why is it possible to use more than 2 ^ 16 constants in a Python function?

From Dev

Why is it possible to use more than 2 ^ 16 constants in a Python function?

From Dev

Redirect the output of one command to more than one command

From Dev

Why more than one map is not working in leaflet

From Dev

Why there are more than one "still running" instances

From Dev

Java exec command prompt more than one line of command

From Dev

Is it possible to redirect the output of a command into more than one command?

From Dev

Plot more than 12 data groups on one chart using PerformanceAnalytics

From Dev

Python if more than one of N variables is true

From Dev

Split more than one word in python

From Java

For loop using more than one list in Python

From Dev

Skipping more than one row in Python csv

From Dev

python pubsub subscribe to more than one topic

From Dev

Python import issue with more than one folders

From Dev

Returning more than one number in a python list

From Dev

Python Dict more than one Max value

From Dev

Integrating more than one function error in python

From Dev

replace more than one pattern python

From Dev

For loop using more than one list in Python

From Dev

Working with more than one datetime format in python

From Dev

python pubsub subscribe to more than one topic

From Dev

Python import issue with more than one folders

From Dev

How to call more than one function in python

From Dev

Skipping more than one row in Python csv

Related Related

  1. 1

    Bash: more than one command line substitution

  2. 2

    Bash Script execute more than one command

  3. 3

    Bash: more than one command line substitution

  4. 4

    Running more than one command with xargs

  5. 5

    Sort command on more than one field

  6. 6

    Why is it possible to use more than 2 ^ 16 constants in a Python function?

  7. 7

    Why is it possible to use more than 2 ^ 16 constants in a Python function?

  8. 8

    Redirect the output of one command to more than one command

  9. 9

    Why more than one map is not working in leaflet

  10. 10

    Why there are more than one "still running" instances

  11. 11

    Java exec command prompt more than one line of command

  12. 12

    Is it possible to redirect the output of a command into more than one command?

  13. 13

    Plot more than 12 data groups on one chart using PerformanceAnalytics

  14. 14

    Python if more than one of N variables is true

  15. 15

    Split more than one word in python

  16. 16

    For loop using more than one list in Python

  17. 17

    Skipping more than one row in Python csv

  18. 18

    python pubsub subscribe to more than one topic

  19. 19

    Python import issue with more than one folders

  20. 20

    Returning more than one number in a python list

  21. 21

    Python Dict more than one Max value

  22. 22

    Integrating more than one function error in python

  23. 23

    replace more than one pattern python

  24. 24

    For loop using more than one list in Python

  25. 25

    Working with more than one datetime format in python

  26. 26

    python pubsub subscribe to more than one topic

  27. 27

    Python import issue with more than one folders

  28. 28

    How to call more than one function in python

  29. 29

    Skipping more than one row in Python csv

HotTag

Archive