首页 > 解决方案 > 地理编码:模块没有属性“google”

问题描述

我知道有几个人已经问过类似的问题,但我是一个初学者,几天来一直试图解决这个问题,但还没有运气。

我想进行地理编码并执行 geocoder.google 命令以获取该位置的纬度和经度,但由于某种原因,我的 Jupyter Notebook 中似乎没有运行“google”属性。

包位置:Python36>Lib>site-packages>geocode,里面包含了init .py、google.py等.py文件的列表。

import geocoder
from geocoder import google
g = geocoder.google('Mountain View, CA')

AttributeError                            Traceback (most recent call last)
<ipython-input-38-baacb41ba0bf> in <module>()
  1 import geocoder
  2 #from geocoder import google
  3 g = geocoder.google('Mountain View, CA')
  4 #g.latlng
  5 

AttributeError: module 'geocoder' has no attribute 'google'

谢谢,

标签: pythonmoduleattributesgeocode

解决方案


我碰巧卸载了 Anaconda 并重新安装了 python 并完成了这项工作。


推荐阅读