running python 2 vs 3

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Mar 20 20:29:55 EDT 2014


On Thu, 20 Mar 2014 21:28:43 +0000, notbob wrote:

> On 2014-03-20, Mark H Harris <harrismh777 at gmail.com> wrote:
> 
>> When I call python2 that means python2.7.6 /
>>
>> When I call python3 that means python3.3.4 /
>>
>> I can also call python2.7, which is 2.7.2 /
>>
>> You get the idea.   There is no one set rule, because there are many
>> distros (gnu/linux) that use python at various versions, and they all
>> us different setups.  Really , you need an install script to snoop out
>> the configurables.
> 
> Weeping Chryst on the cross!!.  No wonder the latest O'Reilly book,
> Learning Python, 5th ed, is 1600 pgs.  I coulda swore someone sed python
> is easy.  ;)


This has nothing to do with Python. It has to do with the way executables 
(applications) are mapped to file names on Unix and Unix-like systems. 
And that in turn is not terribly different from the way that it works on 
Windows as well.

When you type "python" at the command prompt, your system locates an 
executable named "python", then runs it. If you wanted to be annoying, 
you could alias or link the python name to a completely different 
language. Or use a different name altogether:

steve at orac:~$ alias snake=python
steve at orac:~$ snake
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.


This has nothing to do with Python, it's the way Linux works.



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/



More information about the Python-list mailing list