簡體   English   中英

Python - 為什么反向地理編碼會引發 UnicodeDecode 錯誤?

[英]Python - Why is reverse geocode throwing a UnicodeDecode error?

我正在按照此鏈接中的說明進行操作。

代碼如下:

import reverse_geocode
coordinates = (-37.81, 144.96), (31.76, 35.21)
reverse_geocode.search(coordinates)

我收到以下錯誤,而不是鏈接中顯示的輸出:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 464: character maps to <undefined>

請注意,這不是導入問題; 我可以用 Python3 很好地導入模塊。

怎么了?

這看起來是reverse_geocode一個問題 截至 7 月,此問題已在源代碼中修復,但此修復程序尚未發布。

在此之前,解決方法是在安裝 Python 的任何位置修改Lib\\site-packages\\reverse_geocode\\__init__.py 編輯此文件並將參數encoding="utf-8"到對open()所有調用。

修改 Lib\\site-packages\\reverse_geocode_ init _.py 並編輯 open(,encoding="utf-8")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM