简体   繁体   English

Google Cloud SDK - 没有名为ipaddr的模块

[英]Google Cloud SDK - No module named ipaddr

Today our development containers started throwing and error while running the App Engine (GAE) Standard local development environment from the Google Cloud SDK. 今天,我们的开发容器在从Google Cloud SDK运行App Engine(GAE)标准本地开发环境时开始抛出错误。

ERROR    2017-12-15 09:38:37,766 http_runtime.py:396] bad runtime process port ['']
Traceback (most recent call last):
  File "/opt/google-cloud-sdk/platform/google_appengine/_php_runtime.py", line 103, in <module>
    _run_file(__file__, globals())
  File "/opt/google-cloud-sdk/platform/google_appengine/_php_runtime.py", line 97, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/php/runtime/runtime.py", line 39, in <module>
    from google.appengine.tools.devappserver2 import wsgi_server
  File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 34, in <module>
    import ipaddr
ImportError: No module named ipaddr

It looks like it was caused by an upgrade to the latest SDK which happened automatically. 看起来它是由升级到自动发生的最新SDK引起的。

macOS的临时解决方案,将ipaddr.py文件复制到<google-cloud-sdk>/platform/google_appengine

On Ubuntu 14.04, which we are using to match the GAE PHP version of 5.5, the python module they are trying to use isn't installed by default. 在我们用来匹配GAE PHP版本5.5的Ubuntu 14.04上,默认情况下没有安装他们试图使用的python模块。

We installed it with: 我们安装它:

# apt install python-ipaddr

This looks to be because of a feature they have introduced to do with host checking, to prevent DNS rebinding attacks. 这看起来是因为他们引入了与主机检查有关的功能,以防止DNS重新绑定攻击。

In Windows 10, I copied the file ipaddr.py from https://github.com/google/ipaddr-py into the Google\\Cloud SDK\\google-cloud-sdk\\platform\\bundledpython\\Lib\\ folder and it worked. 在Windows 10中,我将文件ipaddr.pyhttps://github.com/google/ipaddr-py复制到Google\\Cloud SDK\\google-cloud-sdk\\platform\\bundledpython\\Lib\\文件夹中,然后才有效。

Not an experienced Python coder, so I'm not sure if it's the best place to put the missing ipaddr.py file, but it works. 不是一个经验丰富的Python编码器,所以我不确定它是否是放置丢失的ipaddr.py文件的最佳位置,但它有效。

This happened after GoogleAppEngine-1.9.65 upgrade in my Windows 7 and it seems C:\\Program Files (x86)\\Google\\google_appengine\\lib\\ipaddr\\ipaddr folder is missing ipaddr.py file. 这发生在我的Windows 7中升级GoogleAppEngine-1.9.65后,似乎C:\\ Program Files(x86)\\ Google \\ google_appengine \\ lib \\ ipaddr \\ ipaddr文件夹缺少ipaddr.py文件。

I had to download ipaddr-2.2.0.tar.gz then unzip it and run following command to install it. 我不得不下载ipaddr-2.2.0.tar.gz然后解压缩并运行以下命令来安装它。

python setup.py install

Hope this helps. 希望这可以帮助。

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

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