问题
When I install the Google App Engine SDK and run the launcher, it asks me to configure the python location:
And when I open Preferences
, it asks for a path to a python executable:
Which path should I insert and what is the difference:
- C:\Python27\python.exe
- C:\Python27\pythonw.exe
回答1:
Looks like Google App Engine couldn't find your python installation. It looks for Python by checking the PATH
environment variable, so it's best to use it.
The short answer is use C:\Python27\pythonw.exe
. I've just installed the latest "GoogleAppEngine-1.9.33.msi", and after I ran "Google App Engine launcher" (C:\Program Files (x86)\Google\google_appengine\launcher\GoogleAppEngineLauncher.exe
), in "Edit -> Preferences" I saw "C:\Python35\pythonw.exe
". (It is because I have Python 3.5 folder before Python 2.7 folder in my Path
environment variable setting.) But the point is App Engine launcher (or installer) chose the pythonw.exe
over python.exe
all by itself.
But as a better solution, I would suggest you to set your Path
environment variable, this will prevent other similar issues in the future.
To set Python on the Path
, if it's not set:
- Right click "Computer" (or "My Computer") and choose "System Properties";
- Switch to "Advanced" tab;
- Press "Environment variables" button;
- Double click "Path" variable in the lower list of system variables;
- In the opened window in "Values" add
C:\Python27\;C:\Python27\Scripts;
to the beginning of the line. Make sure you don't accidently delete anything there! - Press "OK" in this window and "OK" in "Environment variables" window and you're good to go.
Alternatively in item 5, you might want to use user's PATH
from the upper list. I would set Python for all users as I described.
Now launch Google App Engine via "Google App Engine Launcher" and see if in "Edit -> Preferences" you have either "Default if not set: C:\Python27\pythonw.exe" or "Default if not set: C:\Python27\python.exe" written below the field for "Python path". If there's still nothing similar, then it's not the launcher that checks for PATH
, but it's the Installer. Then now it's time to uninstall "Google App Engine" and install it again. After this everything should work as expected. (Btw, Installer checks for Python and other dependecies, so it should report if there're any errors.)
The main difference between python.exe
and pythonw.exe
is:
python.exe
opens console widow when a module is executed with it, or, if run directly from command line, executes a module in a current console window preventing any further commands until the module exits. So basically intended for console applications or debugging.pythonw.exe
on the other hand is intended for GUI apps or no-GUI apps, so if a module is executed withpythonw.exe
, then there's no console window is open, if run via current console a module is executed in a separate process and the console is available for further commands right away. The drawback is no output is provided in this case, i.e. no errors printed as there's no console window associated with running Python module.
Fore details see: official docs, chapter from a book(small but informative), Python mailing list.
Now regarding Google App Engine, on installation page they state:
You will need Python 2.7 to use the App Engine SDK, because the Development Server is a Python application. Download Python 2.7.X (don't use a higher version) from the Python web site.
So since a server is a no-GUI application, that's probably why App Engine chooses pythonw.exe
.
回答2:
According to this QA, pythonw seems to be preferable: https://code.google.com/p/googleappengine/issues/detail?id=11246
Here's the similiar question and answer: pythonw.exe or python.exe?
python.exe is a console (terminal) application for launching CLI-type scripts.
pythonw.exe is a GUI app for launching GUI/no-UI-at-all scripts.
回答3:
From looking at the the docs: https://docs.python.org/2/using/windows.html#executing-scripts
Pythonw basically suppresses the console window. I wouldn't think you'd need one using the app-engine, so, pythonw.exe would be my best guess.
回答4:
The error message says python=None
. Check if you can execute from cmd python -V
to confirm your python build is accessible throughout the system. GAE generally can find your python installation automatically, and confirms your python path before installation.
Try this tutorial if its any help.
回答5:
Pythonw.exe is the executable that does not open the console. Python.exe will open the console. You probably want to use pythonw.exe in this instance because I don't know why you would want a terminal open for the app engine.
https://docs.python.org/2/using/windows.html
The App Engine SDK also didn't find your installation of python. This is probably because you don't have the global env. variable declared.
来源:https://stackoverflow.com/questions/35621677/google-app-engine-launcher-python-path