python command is generally mapped to the latest Python 2.x compiler across different operating systems. However, are there yet such standard way to invoke Python 3.x interpreter (any or the latest version installed)?
… so one could run your Python 3.x compatible script as:
python3 yourscript.py
As a bonus, if there also exists a cross-platform way to invoke virtualenv command to create a local installation for Python 3?
-
Ubuntu seems to provide python3 command, does not seem to provide virtualenv for Python 3.x as prepackaged
-
OSX (Macports, BSD?) prefer python-3.2, python-3.1 commands, provides virtualenv-3.2, virtualenv-3.1
Currently I am trying to have some trial-and-error heuristics to get things done
After reading PEP 394 The “python” Command on Unix-Like Systems and PEP 397 Python launcher for Windows I guess your best option is to use
#! /usr/bin/python3shebang in your script and direct Windows users to install and use Python launcher (pycommand) instead ofpythoncommand.