本文介绍了ImportError:没有名为move的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

版本

  • Python :2.7.14
  • 6 :1.9.0& 1.11.0(都尝试过)
  • 操作系统:mac(10.13.3)& ubuntu(16.04)[都尝试]
  • Python : 2.7.14
  • six : 1.9.0 & 1.11.0(tried on both)
  • OS : mac(10.13.3) & ubuntu(16.04) [tried on both]

错误

说明

在烧瓶应用程序中运行时,该烧瓶应用程序在Google App Engine上运行,同时在本地系统上使用dev_appserver.py运行它,而导入from six.moves import http_client

In flask application which is running on google app engine while running it on local system using dev_appserver.py getting above error while importing from six.moves import http_client

我尝试过的事情

导入六个后,尝试了dir(six),这表明moves在列表中,但无法导入,这很奇怪.

After importing six have tried dir(six) which shows that moves is there in list but it's not able to import it which is very strange.

six.__version__的输出:1.11.0

Output of six.__version__: 1.11.0

如果dir(6)则输出

Output if dir(six)

six内部的输出moves的上方可以看到,导入时仍然给出错误.

As it can be seen from above output moves inside six still giving error while importing it.

为此花费了很多时间,并且没有任何解决方案,到目前为止,这里将不胜感激. :(

Spent a lot of time on this and no solution till now any help would be greatly appreciated here. :(

UPDATE1

错误stacktrace:-

Error stacktrace :-

 from google.cloud.datastore import helpers
 File "/opt/tribes-backend/denv/local/lib/python2.7/site-packages/google/cloud/datastore/helpers.py", line 27, in <module>
 from google.cloud._helpers import _datetime_to_pb_timestamp
 File "/opt/tribes-backend/denv/local/lib/python2.7/site-packages/google/cloud/_helpers.py", line 30, in <module>
 from six.moves import http_client
 ImportError: No module named moves

推荐答案

基于与Google支持团队的跟进,发现不建议使用google-cloud-datastoredatastore进行通信.代替使用ndb进行数据存储通信是一种方法.

Based on follow up with google support team have figured out that communicating with datastore using google-cloud-datastore is deprecatedinstead using ndb for communicating datastore is the way to go.

此处

有关在Python中使用 ndb客户端库入门的文档,此处

Documentation to getting started with ndb client library in python is documented here

这篇关于ImportError:没有名为move的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-12 16:22