I currently have python 2.7.1 installed on my Mac and there are some features of 2.7.3 that I would like to use with my current Python development. I’ve downloaded the and extracted the tar ball into my /Users/mark/Python-2.7.3 but when I run my Python script how do I tell it to use the new 2.7.3 version instead of the system installed 2.7.1?
/Users/mark/Python-2.7.3
MacBook-Pro:Python-2.7.3 mark$ ls
Demo Lib Objects README install-sh
Doc Mac PC RISCOS pyconfig.h.in
Grammar Makefile.pre.in PCbuild Tools setup.py
Include Misc Parser configure
LICENSE Modules Python configure.in
you could either use the interpreter you want to run the script directly:
or set the interpreter in the shebang line:
third option, prepend the path to the interpreter to the
PATHvariable: