barry at python.org
Tue Dec 13 22:47:56 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
On Dec 13, 2011, at 11:27 PM, Kai Mast wrote:
>how do i know if a python-file is executed by Python2 not Python3? There
>is a command "python3" but none called "python2" or am I missing something?
/usr/bin/python (a.k.a. 'python' at your shell prompt) will always be Python
2. You need to say /usr/bin/python3 or 'python3' to invoke Python 3.
This will never change for Ubuntu (or Debian for that matter), unless PEP 394
ends up recommending something different, which I don't expect:
You've noticed that there is no 'python2' command, which is expected. How
many of y'all remember Python 1.x or even Python 0.x? :) It's possible that
PEP 394 will recommend a 'python2' command, but I rather doubt it's worth it
since Python 2.x is at the end of its development life (i.e. there will never
be a Python 2.8, but Python 2.7 will be maintained for longer than the usual
amount of time).
One other thing to note. Although you should generally never need it or use
it, if your code is tied to a very specific Python version, you always have
'python2.7' and 'python3.2' available.
In most cases 'python' and 'python3' is all you need.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the Ubuntu-devel-discuss