Cannot import GoogleMaps name

I followed the instructions

pip install GoogleMaps 

to install google maps. but when I tried to import the GoogleMaps class, it failed, although googlemaps are 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 

Does anyone know why GoogleMaps cannot be imported even though googlemaps are installed?

+7
python google-maps
source share
2 answers

Maybe the documentation is a 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) 
+7
source share

I think the googlemaps module does not have a specific class named GoogleMaps.

if you try help(googlemaps) in the python interpreter then you can see all the classes.

Hope this helps you.

+3
source share

All Articles