Google App Engine启动器Python路径 [英] Google App Engine Launcher Python Path

本文介绍了Google App Engine启动器Python路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我安装Google App Engine SDK并运行启动程序时,它会要求我配置python位置:





我应该插入哪个路径,以及它们之间有什么区别:


  • C:\Python27\python.exe

  • C:\Python27\pythonw.exe


解决方案

例如Google App Engine找不到您的python安装。它通过检查 PATH 环境变量来查找Python,因此最好使用它。



简短的回答是使用 C:\Python27\pythonw.exe 。我刚刚安装了最新的GoogleAppEngine-1.9.33.msi,在运行Google App Engine启动程序( C:\程序文件(x86)\Google\google_appengine\\ \\ Launchher \ GoogleAppEngineLauncher.exe ),在编辑 - >首选项我看到 C:\Python35\pythonw.exe 。 (这是因为我的 Path 环境变量设置中的Python 2.7文件夹之前有Python 3.5文件夹。)但是,App Engine启动器(或安装程序)选择 pythonw.exe 超过 python.exe 本身。



< a href =https://i.stack.imgur.com/C8a90.png =nofollow noreferrer>

但是作为一个更好的解决方案,我建议你设置 Path 环境变量,这将防止将来出现其他类似的问题。



Path上设置Python ,如果它没有设置:


  1. 右键点击计算机(或我的电脑)并选择系统属性;

  2. 切换到高级标签;
  3. 按下环境变量按钮;
  4. 在系统变量的较低列表中;
  5. 在值中打开的窗口中a dd C:\Python27\; C:\Python27\Scripts; 到行的开头。确保您不会意外删除任何东西!

  6. 在此窗口中按下确定,在环境变量窗口中点击确定,您就可以开始了。
  7. >

或者在第5项中,您可能希望使用上层列表中的用户 PATH 。我将为所有用户设置Python,如我所述。



现在通过Google App Engine启动器启动Google App Engine,并在编辑 - >首选项中查看是否有如果未设置为默认值:C:\ Python27 \pythonw.exe或如果未设置默认值:C:\ Python27 \python.exe,写在Python路径字段下。如果仍然没有类似的东西,那么它不是检查 PATH 的启动程序,但它是安装程序。那么现在是卸载Google App Engine并重新安装的时候了。在此之后,所有事情都应按预期工作(顺便说一下,安装程序检查Python和其他依赖项,所以它应该报告是否有任何错误。)



python之间的主要区别。
$ b


  • code> python.exe 在使用
    执行模块时打开控制台窗口,或者,如果直接从命令行运行,则在当前
    控制台中执行模块窗口阻止任何进一步的命令,直到模块
    退出。所以基本上用于控制台应用程序或调试。另一方面,
  • pythonw.exe 适用于GUI应用程序或无GUI
    应用程序,所以如果使用 pythonw.exe 执行模块,则没有
    控制台窗口打开,如果通过当前控制台运行,则模块为
    在一个单独的过程中执行,控制台可用于进一步的
    命令。缺点是在这个
    的情况下没有提供输出,即没有输出错误,因为没有与运行Python模块的
    关联的控制台窗口。



有关详细信息,请参阅:官方文档书中的章节(小但信息丰富) Python邮件列表

现在关于Google App Engine,在安装页面,他们表示:


您将需要Python 2.7才能使用App Engine SDK,因为
Development服务器是一个Python应用程序。从Python网站下载Python 2.7.X
(不要使用更高版本)。


服务器是一个非GUI应用程序,这可能是为什么App Engine选择 pythonw.exe


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

解决方案

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:

  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; 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. 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 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. 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.

这篇关于Google App Engine启动器Python路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆