python 2.7无法导入地理编码器库

时间:2017-08-15 14:37:27

标签: python windows python-2.7 geocoding

win32上的Python 2.7.10。 Windows 8.1

使用pip安装地理编码器库https://pypi.python.org/pypi/geocoder/1.8.0

尝试导入库时出现此错误

char line[100];
fgets(line, 100, stdin);
// if a newline was stored, remove it
if (strrchr(line, '\n') != NULL) {
    *(strrchr(line, '\n')) = '\0';
}

我认为只需安装一个装饰器库就可以解决这个问题,但是已经安装了该库

>>> import geocoder
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Python27\ArcGIS10.4\lib\site-packages\geocoder\__init__.py", line 36, in <module>
    from geocoder.api import get, yahoo, bing, geonames, mapquest, google, mapbox  # noqa
  File "C:\Python27\ArcGIS10.4\lib\site-packages\geocoder\api.py", line 29, in <module>
    from geocoder.freegeoip import FreeGeoIP
  File "C:\Python27\ArcGIS10.4\lib\site-packages\geocoder\freegeoip.py", line 6, in <module>
    import ratelim
  File "C:\Python27\ArcGIS10.4\lib\site-packages\ratelim\__init__.py", line 6, in <module>
    from decorator import decorator
ImportError: No module named decorator
>>> 

更新

C:\Python27\ArcGIS10.4\Scripts>pip install decorator
Requirement already satisfied: decorator in c:\python27\arcgis10.4\lib\site-packages

可能使这一点复杂化的是我通过arcgis安装了python 32位和64位...

1 个答案:

答案 0 :(得分:0)

尝试运行以下命令来安装模块

[root@server] python -m pip install decorator

这应该将模块安装到运行python命令时启动的解释器的python库中

然后尝试再次启动你的解释器并尝试导入模块(假设它没有说它已经满足)

[root@server] python
>> from decorator import decorator
>>

如果它确实表示它已经满足,那么您可以尝试使用pip卸载它,然后通过显式指定python -m命令重新安装它

[root@server] pip uninstall decorator
[root@server] python -m pip install decorator

然后您可以检查模块是否在默认解释器中可用

[root@server] python
>> from decorator import decorator
>>