Python3安裝geohash

Python3安裝geohash

Geohash是一個能夠對地理位置信息進行加密和解密的系統,https://en.wikipedia.org/wiki/Geohash函數

Python安裝geohash庫後,可調用decode()encode()函數。加密

按照通常的步驟進行安裝pip install geohash,在確認安裝成功後,import Geohash 仍然報錯: ImportError: No module named ‘geohash’, 說找不到Geohash模塊。翻譯

百思不得其解。後面想到多是Python3和Python2有所不同,我用的是Python3。在網上找到一個解決方案:code

rename the package name to be geohash rather than Geohash and then change init.py to import from .geohash (with a dot in front of the module name) rather than from geohash, the package should work for Python 3.5.2.ip

翻譯:get

將包名稱重命名爲geohash而不是Geohash,而後將init.py更改成從.geohash(在模塊名稱前面有一個點)而不是從geohash導入,該包應該適用於Python 3.5.2。hash

按照這個方法修改文件名稱和 init.py 中的內容後,成功。it

相關文章
相關標籤/搜索