I know how what to write in a python script to tell a unix box which version of python to run (#!/usr/bin/env python3.2), but how do I do that in windows. I will be deploying a program through distutils to windows boxes that have both python2.7 and 3.2 installed. I need to force it to use 2.7
Thanks!
Even on unix with a shebang (
#!) you are not forcing which version to run under. If the program is not executed directly (./my.py) and instead is run likepython2 my.pythen Python 2 will still be used.I would suggest the safest way is to check the version at the beginning of your script and bail out with an error message if it’s not suitable, for example: