osx - Applescript uses wrong python version, how to change? -


I recently installed Python 2.6.5 on OS X 2.6.1. When I try to execute the Python script, AppleScript Editor gives me version 2.6.1 if I execute the following line:

ApplePrint:

  Open script "Python -c \" sys with import version; Print version \ ""  

But if I execute the same line in the OS X terminal then I get version 2.6.5:

OS X Terminal:

  Python-C "from the system import version; print edition"  

What could be wrong? Can it be somehow easily fixed?

Python 2.6.5 installer modifies your ~ / $ PATH At the beginning of the bash_profile file for entering bin directory of Python 2.6.5, which is next to / usr / bin is where the OS The default Python interpreter is false. When you log in through the terminal, this profile is automatically read while using do shell script You can either complete the python executable path You must specify (possibly the best option), or you can already read the bash profile of your script (though keep in mind that using do shell script sh , No bash ):

  do shell script ". $ {HOME} / .bash_profile; python - C 'import System, print (sys.version) ''  

Comments