简体   繁体   English

Google App Engine启动器Python路径

[英]Google App Engine Launcher Python Path

When I install the Google App Engine SDK and run the launcher, it asks me to configure the python location: 当我安装Google App Engine SDK并运行启动器时,它会要求我配置python位置:

在此输入图像描述


And when I open Preferences , it asks for a path to a python executable: 当我打开Preferences ,它会询问python可执行文件的路径:

在此输入图像描述


Which path should I insert and what is the difference: 我应该插入哪条路径,区别是什么:

  • C:\\Python27\\python.exe C:\\ Python27 \\ python.exe
  • C:\\Python27\\pythonw.exe C:\\ Python27 \\ pythonw.exe

Looks like Google App Engine couldn't find your python installation. 看起来Google App Engine无法找到您的python安装。 It looks for Python by checking the PATH environment variable, so it's best to use it. 它通过检查PATH环境变量来查找Python,因此最好使用它。

The short answer is use C:\\Python27\\pythonw.exe . 简短的回答是使用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 ". 我刚刚安装了最新的“GoogleAppEngine-1.9.33.msi”,在我运行“Google App Engine启动器”( C:\\Program Files (x86)\\Google\\google_appengine\\launcher\\GoogleAppEngineLauncher.exe )后,“编辑 - >首选项“我看到了” 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. (这是因为我在Path环境变量设置中的Python 2.7文件夹之前有Python 3.5文件夹。)但重点是App Engine启动器(或安装程序)选择pythonw.exe不是python.exe

在此输入图像描述

But as a better solution, I would suggest you to set your Path environment variable, this will prevent other similar issues in the future. 但作为更好的解决方案,我建议您设置Path环境变量,这样可以防止将来出现其他类似问题。

To set Python on the Path , if it's not set: 要在Path上设置Python,如果未设置:

  1. Right click "Computer" (or "My Computer") and choose "System Properties"; 右键单击“计算机”(或“我的电脑”),然后选择“系统属性”;
  2. Switch to "Advanced" tab; 切换到“高级”选项卡;
  3. Press "Environment variables" button; 按“环境变量”按钮;
  4. Double click "Path" variable in the lower list of system variables; 双击系统变量下方列表中的“路径”变量;
  5. In the opened window in "Values" add C:\\Python27\\;C:\\Python27\\Scripts; 在“值”的打开窗口中添加C:\\Python27\\;C:\\Python27\\Scripts; to the beginning of the line. 到了行的开头。 Make sure you don't accidently delete anything there! 确保你不会意外删除任何东西!
  6. 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. 或者在第5项中,您可能希望从上面的列表中使用用户的PATH I would set Python for all users as I described. 我会按照我的描述为所有用户设置Python。

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". 现在通过“Google App Engine Launcher”启动Google App Engine,看看在“编辑 - >首选项”中是否有“如果未设置则默认:C:\\ Python27 \\ pythonw.exe”或“如果未设置则默认:C:\\ Python27 \\ python.exe“写在”Python路径“字段下方。 If there's still nothing similar, then it's not the launcher that checks for PATH , but it's the Installer. 如果仍然没有类似的东西,那么它不是检查PATH的启动器,而是安装程序。 Then now it's time to uninstall "Google App Engine" and install it again. 然后现在是时候卸载“Google App Engine”并再次安装它。 After this everything should work as expected. 在此之后,一切都应该按预期工作。 (Btw, Installer checks for Python and other dependecies, so it should report if there're any errors.) (顺便说一句,安装程序会检查Python和其他依赖项,因此它应该报告是否有任何错误。)

The main difference between python.exe and pythonw.exe is: python.exepythonw.exe的主要区别是:

  • 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. python.exe在使用它执行模块时打开控制台窗口,或者,如果直接从命令行运行,则在当前控制台窗口中执行模块,防止任何进一步的命令,直到模块退出。 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 with pythonw.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. 另一方面, pythonw.exe用于GUI应用程序或无GUI应用程序,因此如果使用pythonw.exe执行模块,则没有打开控制台窗口,如果通过当前控制台运行,则模块在单独的进程中执行并且控制台可立即用于进一步的命令。 The drawback is no output is provided in this case, ie no errors printed as there's no console window associated with running Python module. 缺点是在这种情况下没有提供输出,即没有打印错误,因为没有与运行Python模块相关联的控制台窗口。

Fore details see: official docs , chapter from a book(small but informative) , Python mailing list . 前面的详细信息请参阅: 官方文档书中的章节(小但信息丰富)Python邮件列表

Now regarding Google App Engine, on installation page they state: 现在关于Google App Engine,在安装页面上,他们说:

You will need Python 2.7 to use the App Engine SDK, because the Development Server is a Python application. 您将需要Python 2.7才能使用App Engine SDK,因为Development Server是一个Python应用程序。 Download Python 2.7.X (don't use a higher version) from the Python web site. 从Python网站下载Python 2.7.X(不要使用更高版本)。

So since a server is a no-GUI application, that's probably why App Engine chooses pythonw.exe . 因此,由于服务器是一个无GUI应用程序,这可能是App Engine选择pythonw.exe

According to this QA, pythonw seems to be preferable: https://code.google.com/p/googleappengine/issues/detail?id=11246 根据此QA,pythonw似乎更可取: https//code.google.com/p/googleappengine/issues/detail? id = 11246

Here's the similiar question and answer: pythonw.exe or python.exe? 这是类似的问题和答案: pythonw.exe或python.exe?

python.exe is a console (terminal) application for launching CLI-type scripts. python.exe是用于启动CLI类型脚本的控制台(终端)应用程序。

pythonw.exe is a GUI app for launching GUI/no-UI-at-all scripts. pythonw.exe是一个GUI应用程序,用于启动GUI / no-UI-at-all脚本。

From looking at the the docs: https://docs.python.org/2/using/windows.html#executing-scripts 从查看文档: https//docs.python.org/2/using/windows.html#executing-scripts

Pythonw basically suppresses the console window. Pythonw基本上抑制了控制台窗口。 I wouldn't think you'd need one using the app-engine, so, pythonw.exe would be my best guess. 我不认为你需要使用app-engine,因此,pythonw.exe将是我最好的猜测。

The error message says python=None . 错误消息显示python=None Check if you can execute from cmd python -V to confirm your python build is accessible throughout the system. 检查是否可以从cmd python -V执行以确认您的python构建是否可以在整个系统中访问。 GAE generally can find your python installation automatically, and confirms your python path before installation. GAE通常可以自动找到你的python安装,并在安装之前确认你的python路径。

Try this tutorial if its any help. 如果有任何帮助,请试用本教程

Pythonw.exe is the executable that does not open the console. Pythonw.exe是无法打开控制台的可执行文件。 Python.exe will open the console. Python.exe将打开控制台。 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. 您可能希望在此实例中使用pythonw.exe,因为我不知道您为什么要为应用程序引擎打开终端。

https://docs.python.org/2/using/windows.html https://docs.python.org/2/using/windows.html

The App Engine SDK also didn't find your installation of python. App Engine SDK也没有找到你的python安装。 This is probably because you don't have the global env. 这可能是因为你没有全球环境。 variable declared. 变量声明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM