简体   繁体   English

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

[英]python 2.7 cannot import geocoder library

Python 2.7.10 on win32. Win32上的Python 2.7.10。 windows 8.1 Windows 8.1

used pip to install geocoder library https://pypi.python.org/pypi/geocoder/1.8.0 使用pip安装地址解析器库https://pypi.python.org/pypi/geocoder/1.8.0

get this error when I try and import the library 尝试导入库时出现此错误

>>> 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
>>> 

I thought just an install of the decorator library would fix the situtation but that library was already installed 我以为只要安装装饰器库就可以解决问题,但该库已经安装

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

update 更新

C:\Users\rizagha>python --version
Python 2.7.10

C:\Users\rizagha>python
Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from decorator import decorator
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named decorator

something that may be complicating this is I have python 32 bit and 64 bit installed via arcgis... 可能使事情复杂化的是我通过arcgis安装了python 32位和64位...

Try running the following command to install the module 尝试运行以下命令以安装模块

[root@server] python -m pip install decorator

This should install the module to the python library of the interpreter that starts when you run the python command 这应该将模块安装到运行python命令时启动的解释器的python库中

then try start up your interpreter again and try to import the module (assuming it doesn't say it's already satisfied) 然后尝试再次启动您的解释器并尝试导入模块(假设它不表示已满足要求)

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

if it does say that it's already satisfied, then you can try to uninstall it using pip and then reinstall it by explicitly specifying the python -m command 如果确实表明已满足要求,则可以尝试使用pip卸载它,然后通过显式指定python -m命令来重新安装它

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

then you can check to see if the module is available in your default interpretor 那么您可以检查默认解释器中模块是否可用

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM