Launching Python environments
By default, Python is installed on a computer with the Python interpreter included on the system path. This means that the interpreter will monitor the Command Prompt for any call to python
.Â
The most common usage for Python is to run a script. However, it may be desirable to launch a specific version of Python for a specific program.
How to do it...
- The most basic command to execute a Python program is as follows:
$ python <script_name>.py
- The following examples show how to launch specific versions of Python, as needed:
$ python2 some_script.py # Use the latest version of Python 2 $ python2.7 ... # Specifically use Python 2.7 $ python3 ... # Use the latest version of Python 3 $ python3.5.2 ... # Specifically use Python 3.5.2
How it works...
Calling python2
or python3
opens the latest installed version of the respective branch, whereas the other examples show how to invoke a specific version number. Regardless of whether a newer version...