On Windows, you must change the file associations , for example, using the right-click → Open with ...
→ Choose default program
or the control panel Settings folder. You can choose between several python installations by going to python.exe using the browse button:
Alternatively, you can change the communication in the shell by typing
ftype Python.File="C:\Python27\python.exe" "%1" %*
Please note that this requires administrator rights. If UAC is enabled on your computer, right-click cmd in the Start menu and select Run as administrator
.
On operating systems compatible with freedesktop.org, you can configure communication with xdg-mime
.
In debian based distributions, you can change python by default with update-alternatives
. On all systems, you can also symbolize python in your path to the correct implementation, for example:
$ sudo ln -sf python2.7 /usr/bin/python
If the file is marked as executable, it can also be executed directly from the command line or GUI if it starts with #!
and interpreter name:
To select a specific version of Python for your program only, you can run your Python program using one of the following lines:
#!/usr/bin/env python2.7
phihag
source share