我正在尝试使python的Google云模块正常工作,但是难以正确查看模块以进行验证。我什至尝试了几种拼写形式,但没有乐趣。
我可以成功导入模块,但是imp无法验证它:
result = result + item.data
我已经通过使用另一种验证方法解决了我的问题,但是我想了解出了什么问题。大多数(但不是全部)其他模块都可以正确验证。
>>> pip.get_installed_distributions()
[
urllib3 1.23 (/home/user/.local/lib/python2.7/site-packages),
six 1.11.0 (/home/user/.local/lib/python2.7/site-packages),
setuptools 40.0.0 (/home/user/.local/lib/python2.7/site-packages),
rsa 3.4.2 (/home/user/.local/lib/python2.7/site-packages),
requests 2.19.1 (/home/user/.local/lib/python2.7/site-packages),
pytz 2018.5 (/home/user/.local/lib/python2.7/site-packages),
pysnmp 4.4.4 (/home/user/.local/lib/python2.7/site-packages),
pysmi 0.3.1 (/home/user/.local/lib/python2.7/site-packages),
pycryptodomex 3.6.4 (/home/user/.local/lib/python2.7/site-packages),
pyasn1 0.4.4 (/home/user/.local/lib/python2.7/site-packages),
pyasn1-modules 0.2.2 (/home/user/.local/lib/python2.7/site-packages),
psutil 5.4.6 (/home/user/.local/lib/python2.7/site-packages),
protobuf 3.6.0 (/home/user/.local/lib/python2.7/site-packages),
proto-google-cloud-logging-v2 0.91.3 (/home/user/.local/lib/python2.7/site-packages),
proto-google-cloud-error-reporting-v1beta1 0.15.3 (/home/user/.local/lib/python2.7/site-packages),
proto-google-cloud-datastore-v1 0.90.4 (/home/user/.local/lib/python2.7/site-packages),
ply 3.11 (/home/user/.local/lib/python2.7/site-packages),
oauth2client 3.0.0 (/home/user/.local/lib/python2.7/site-packages),
idna 2.7 (/home/user/.local/lib/python2.7/site-packages),
httplib2 0.11.3 (/home/user/.local/lib/python2.7/site-packages),
grpcio 1.13.0 (/home/user/.local/lib/python2.7/site-packages),
grpc-google-iam-v1 0.11.4 (/home/user/.local/lib/python2.7/site-packages),
googleapis-common-protos 1.5.3 (/home/user/.local/lib/python2.7/site-packages),
google 2.0.1 (/home/user/.local/lib/python2.7/site-packages),
google-resumable-media 0.3.1 (/home/user/.local/lib/python2.7/site-packages),
google-gax 0.15.16 (/home/user/.local/lib/python2.7/site-packages),
google-cloud 0.32.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-vision 0.29.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-videointelligence 1.0.1 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-translate 1.3.1 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-trace 0.17.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-storage 1.10.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-speech 0.30.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-spanner 0.29.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-runtimeconfig 0.28.1 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-resource-manager 0.28.1 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-pubsub 0.30.1 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-monitoring 0.28.1 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-logging 1.4.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-language 1.0.2 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-firestore 0.28.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-error-reporting 0.28.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-dns 0.28.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-datastore 1.4.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-core 0.28.1 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-container 0.1.1 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-bigtable 0.28.1 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-bigquery 0.28.0 (/home/user/.local/lib/python2.7/site-packages),
google-cloud-bigquery-datatransfer 0.1.1 (/home/user/.local/lib/python2.7/site-packages),
google-auth 1.5.0 (/home/user/.local/lib/python2.7/site-packages),
google-api-core 1.2.1 (/home/user/.local/lib/python2.7/site-packages),
gapic-google-cloud-logging-v2 0.91.3 (/home/user/.local/lib/python2.7/site-packages),
gapic-google-cloud-error-reporting-v1beta1 0.15.3 (/home/user/.local/lib/python2.7/site-packages),
gapic-google-cloud-datastore-v1 0.15.3 (/home/user/.local/lib/python2.7/site-packages),
futures 3.2.0 (/home/user/.local/lib/python2.7/site-packages),
future 0.16.0 (/home/user/.local/lib/python2.7/site-packages),
enum34 1.1.6 (/home/user/.local/lib/python2.7/site-packages),
dill 0.2.8.2 (/home/user/.local/lib/python2.7/site-packages),
chardet 3.0.4 (/home/user/.local/lib/python2.7/site-packages),
certifi 2018.4.16 (/home/user/.local/lib/python2.7/site-packages),
cachetools 2.1.0 (/home/user/.local/lib/python2.7/site-packages),
beautifulsoup4 4.6.0 (/home/user/.local/lib/python2.7/site-packages)
]
>>> imp.find_module('google-cloud')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named google-cloud
>>> imp.find_module('google')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named google
>>> import google.cloud
>>> imp.find_module('google')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named google
>>> imp.find_module('google.cloud')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named google.cloud
>>> imp.find_module('google-cloud')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named google-cloud
可以imp
之前需要做什么?
答案 0 :(得分:-1)
您需要在Python环境中安装google-cloud。
pip install google-cloud