gpt4 book ai didi

python - 无法导入名称 GoogleMaps

转载 作者:太空狗 更新时间:2023-10-29 21:31:27 25 4
gpt4 key购买 nike

我按照指示去做了

pip install GoogleMaps

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

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?

最佳答案

也许文档有点过时:使用 Client 而不是 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)

关于python - 无法导入名称 GoogleMaps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27292897/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com