即使安装了模块,也会获得ImportError

时间:2016-06-15 13:46:56

标签: python google-cloud-platform stackdriver google-cloud-debugger

已安装:

 pip install google-python-cloud-debugger
Requirement already satisfied (use --upgrade to upgrade): google-python-cloud-debugger in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): google-api-python-client in /usr/local/lib/python2.7/dist-packages (from google-python-cloud-debugger)
Requirement already satisfied (use --upgrade to upgrade): six<2,>=1.6.1 in /usr/local/lib/python2.7/dist-packages (from google-api-python-client->google-python-cloud-debugger)
Requirement already satisfied (use --upgrade to upgrade): httplib2<1,>=0.8 in /usr/local/lib/python2.7/dist-packages (from google-api-python-client->google-python-cloud-debugger)
Requirement already satisfied (use --upgrade to upgrade): oauth2client in /usr/local/lib/python2.7/dist-packages (from google-api-python-client->google-python-cloud-debugger)
Requirement already satisfied (use --upgrade to upgrade): uritemplate<1,>=0.6 in /usr/local/lib/python2.7/dist-packages (from google-api-python-client->google-python-cloud-debugger)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /usr/local/lib/python2.7/dist-packages (from oauth2client->google-api-python-client->google-python-cloud-debugger)
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules>=0.0.5 in /usr/local/lib/python2.7/dist-packages (from oauth2client->google-api-python-client->google-python-cloud-debugger)
Requirement already satisfied (use --upgrade to upgrade): rsa>=3.1.4 in /usr/local/lib/python2.7/dist-packages (from oauth2client->google-api-python-client->google-python-cloud-debugger)
Requirement already satisfied (use --upgrade to upgrade): simplejson>=2.5.0 in /usr/local/lib/python2.7/dist-packages (from uritemplate<1,>=0.6->google-api-python-client->google-python-cloud-debugger)

但是在尝试导入时,我得到了ImportError: No module named uritemplate。 stacktrace是: googleapiclient/discovery.py", line 53, in <module>

安装了uritemplate的东西:

pip install uritemplate
Requirement already satisfied (use --upgrade to upgrade): uritemplate in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): simplejson>=2.5.0 in /usr/local/lib/python2.7/dist-packages (from uritemplate)

直接导入uritemplate也不起作用..

2 个答案:

答案 0 :(得分:0)

导入云调试器或直接uritemplate时是否调用python2.7或python3?

$ python2.7 
>>> import uritemplate
>>> 
$ python3 
>>> import uritemplate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named uritemplate

请注意,Cloud调试器(和uritemplate)适用于python 2.7。

答案 1 :(得分:0)

我有同样的问题。 uritemplate已下载到我的文件系统。 解决之后,同样适用于oauth2client 我不得不更新。从https://github.com/google/oauth2client

下载

所以我将更新后的版本下载到我的预测中并添加了它的路径。