geohash库安装--python版

Geohash是一个Python模块,它提供了在纬度和经度坐标之间解码和编码Geohashes的函数。可调用decode()encode()函数。

源码地址:https://github.com/vinsci/geohash

python3 安装方法: pip install geohash

安装成功后,仍无法 import geohash, 提示报错:ImportError: No module named ‘geohash’。

网上查询各类方法后,找到一个解决方法:

1. 将Geohash文件名改成 geohash

2. geohash文件夹下的 __init__.py 中的   from geohash import decode_exactly, decode, encode

改成   from .geohash import decode_exactly, decode, encode   

geohash前多加一个 ‘.’ 即可。

举例:geohash.decode('wt7j')
》》》('30', '117')

 

你可能感兴趣的:(geohash库安装--python版)