即使安装了模块,也会出现 ImportError

Getting ImportError even though module is installed

已安装:

 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。 堆栈跟踪是: 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 也不起作用..

导入云调试器时调用的是python2.7还是python3,还是直接调用uritemplate?

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

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

我也遇到了同样的问题。 uritemplate 已下载到我的文件系统。 解决后, oauth2client 也是如此 我必须更新。下载自 https://github.com/google/oauth2client

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