导入时超额返回属性错误

2024-06-11 02:18:05 发布

您现在位置:Python中文网/ 问答频道 /正文

圣诞节前我一直在测试一些代码,现在它给了我一个属性错误。还有其他人有这个问题吗?还是我的主机坏了

代码:

from geopy.geocoders import Nominatim
import overpy

api = overpy.Overpass()

geolocator = Nominatim(user_agent="specify_your_app_name_here")
location = geolocator.geocode(input('Enter location:'))


cords = (location.latitude, location.longitude, location.latitude, location.longitude)


result = api.query("node"+f'{cords}'+";out;")

node = result.nodes[0]
print(node.id)
print(location.latitude)
print(location.longitude)

返回

AttributeError: module 'overpy' has no attribute 'Overpass

此处链接的文档

https://readthedocs.org/projects/python-overpy/downloads/pdf/stable/


Tags: 代码importapinode属性locationresultprint