本文介绍了无法导入名称GoogleMaps的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循指令

I followed the instruction

pip install GoogleMaps

安装谷歌地图。但是当我尝试导入GoogleMaps类时,虽然安装了googlemaps,但它失败了。

to install google maps. but when I tried to import the GoogleMaps class, it failed although googlemaps is installed.

Python 2.7.6 (default, Mar 22 2014, 22:59:38)  [GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import googlemaps 
>>>
>>> from googlemaps import GoogleMaps 
Traceback (most recent call last):   
File "<stdin>", line 1, in <module> 
ImportError: cannot import name GoogleMaps

有谁知道为什么GoogleMaps无法导入,尽管googlemaps是安装?

Does anyone know why GoogleMaps cannot be imported although googlemaps is installed?

推荐答案

也许文档有些过时:使用 Client 而不是 GoogleMaps

Maybe the documentation is a little bit outdated: use Client instead of GoogleMaps

>>> from googlemaps import Client
>>> dir(Client)
['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_generate_auth_url', '_get', 'directions', 'distance_matrix', 'elevation', 'elevation_along_path', 'geocode', 'reverse_geocode', 'timezone']
>>> help(Client)

这篇关于无法导入名称GoogleMaps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 11:43