我在appengine_config.py
中有以下代码:
...
import six
print six.__version__
print six.moves
import six.moves
输出如下:
1.11.0
<module 'six.moves' (built-in)>
ERROR 2018-04-17 10:51:19,875 wsgi.py:263]
Traceback (most recent call last):
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 351, in __get
attr__
self._update_configs()
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 287, in _update_configs
self._registry.initialize()
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 160, in initi
alize
import_func(self._modname)
File "/home/user/project/appengine_config.py", line 17, in <module>
from six.moves import http_client
ImportError: No module named moves
moves
在通过six
访问时是如何成为模块的,但是无法自行导入?
提供有关环境的背景信息:
我使用干净的Debian GCE VM。
从virtualenv中安装python 2.7,virtualenv,安装一个基本依赖项的简短列表。
six.moves
从python shell 答案 0 :(得分:0)
您已导入six
。这包括six.moves
。所以只需将其用作six.moves
即可。要导入只是移动,请使用:
from six import moves