You can add a shebang line the to the top of the script:
#!/usr/bin/env python2.7
But that will only work when executing as ./my_program.py
.
If you execute as python my_program.py
, then the whatever Python version that which python
returns will be used.
In re: to virtualenv use: virtualenv -p /usr/bin/python3.2
or whatever to set it up to use that Python executable.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…