1

I am using Google App Engine but starting programs from its interface is not working. The logs in GAE indicate it is trying to use Python 2.6 and it needs 2.7 so it fails to run.

I have used Python 2.7 before and when I type python from any path in a terminal, the 2.7 banner comes up.

However, if I invoke /usr/bin/python I get the 2.6 banner.

Even if I am in /usr/bin and I type python I get the 2.7 banner. My env variables mention plenty of stuff about 2.7.

I tried changing the path to python in GAE from /usr/bin/python to python which did not work.

What am I missing?

EDIT:

It seems that user related path is superseded by system wide path (guessing).
/etc/path contains only /usr/bin, /bin, /usr/sbin, /sbin, /usr/local/bin (in that order)

my path under env contains much more things that have been added over time, but it seems that the very first thing that is looked at is /etc/path, which is taking precedence over /usr/bin/env

EDIT:

The root of the problem turned out to be OSX relying on outdated Python libraries that don't install to the same place as new Python installers. It is easy to mess up your system messing with the old Python 2.5 and 2.6 stuff on OSX Snow Leopard. I ended up linking /usr/bin/python to /Library/Frameworks/Python.framework/Versions/2.7/bin/python. This works so far but I could see this messing something up, so read more before you use this.

Greenonline
  • 2,390
fightermagethief
  • 863
  • 4
  • 12
  • 26

2 Answers2

1

In Linux we have this thing called Alternatives system that handles these situations. I'd check if the python binary is a symlink to another python or not, and change it to the one I want if so.
Also check if your PATH contains ".", and if it does, try removing it.

Matthieu Riegler
  • 348
  • 4
  • 13
behrooz
  • 735
0

I had a similar problem and it was because I had Cygwin in my PATH variable before the Python installation, where a python.exe file is located.

Generally, check whether a python.exe file can be found in directories listed in your PATH variable before your "actual" Python install directory.

Greenonline
  • 2,390
Niko
  • 113