为什么在Jupyter Notebook中无法导入geopy.distance.vincenty()?我已经安装了geopy 2.0.0。

11
from geopy.distance import vincenty

我刚刚安装了geopy2.0.0版本,我想使用文档中提到的geopy.distance.vincenty()。然而,它返回了ImportError: cannot import name 'vincenty' from 'geopy.distance'错误。如果我尝试

from geopy import distance

现在变成了AttributeError: module 'geopy.distance' has no attribute 'vincenty'。大约两三个月前我在Google Colab上使用时还是好的。发生了什么?最新版本可能已经去掉了这个属性吗?

1个回答

27

是的,它已经被移除了。请看变更日志中的Breaking Changes section ,其中包含以下条目:

移除 geopy.distance.vincenty,请使用 geopy.distance.geodesic 替代。


3
非常感谢!一度我还以为是我的安装出了问题。 - Paw in Data

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接