【问题标题】:IPython fails to import GeopandasIPython 无法导入 Geopandas
【发布时间】:2017-05-06 01:03:01
【问题描述】:

从 conda-forge 成功安装 Geopandas conda 包后如下:

conda install -c conda-forge geopandas

当我尝试在 IPython(Jupyter 笔记本)中导入它时,使用:

import geopandas as gpd

尽管安装了所有依赖项(numpy、pandas、shapely、fiona、6、pyproj)并且是最新的,但我始终收到以下错误:

---------------------------------------------------------------------
------
ImportError                               Traceback (most recent call 
last)
<ipython-input-1-13760ce748ee> in <module>()
      4 import matplotlib.mlab as mlab
      5 
----> 6 import geopandas as gpd
      7 import seaborn as sns
      8 from sklearn import preprocessing

    //anaconda/lib/python2.7/site-packages/geopandas/__init__.py in <module>()
----> 1 from geopandas.geoseries import GeoSeries
      2 from geopandas.geodataframe import GeoDataFrame
      3 
      4 from geopandas.io.file import read_file
      5 from geopandas.io.sql import read_postgis

//anaconda/lib/python2.7/site-packages/geopandas/geoseries.py in <module>()
      6 from pandas import Series, DataFrame
      7 from pandas.core.indexing import _NDFrameIndexer
----> 8 from pandas.util.decorators import cache_readonly
      9 import pyproj
      10 from shapely.geometry import box, shape, Polygon, Point

ImportError: No module named decorators

关于可能导致错误的任何建议?

【问题讨论】:

  • 将 pandas 更新到 0.20.1,这将得到修复
  • 谢谢,更新到 0.20.1 解决了
  • 我在 (0.2.1) 中仍然存在这个问题 - 我不知道编号约定:0.20.1 和 0.2.1 是否相同?

标签: python pandas numpy conda geopandas


【解决方案1】:

为了让 Jeff 的评论更加突出,这已在 pandas 0.20.1 中得到修复。
所以通常情况下,如果您现在安装最新的 pandas 版本(不是 0.20.0),您应该不会收到此错误。

【讨论】:

  • 这仍然发生在 0.2.1 中,我得到同样的错误:mport geopandas as gpd Traceback(最近一次调用最后):文件“”,第 1 行,在 文件“ .\geopandas.py",第 12 行,在 from geopandas import GeoSeries, GeoDataFrame ImportError: cannot import name GeoSeries
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-05-14
  • 1970-01-01
  • 2021-04-11
  • 2020-10-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多