[英]Is there a way to fix this import error for geopandas?
我正在嘗試讓 GemGIS 工作。 在安裝過程中,我通過以下方式在我的環境中安裝了庫geopandas和gemgis :
conda install -c conda-forge geopandas
和
pip install gemgis
我使用了 anaconda powershell,一切看起來都還不錯。 當我啟動 jupyter lab 並嘗試導入這些包時,我收到以下錯誤代碼:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-24-a62d01c1d62e> in <module>
----> 1 import geopandas as gpd
G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\__init__.py in <module>
----> 1 from geopandas._config import options # noqa
2
3 from geopandas.geoseries import GeoSeries # noqa
4 from geopandas.geodataframe import GeoDataFrame # noqa
5 from geopandas.array import points_from_xy # noqa
G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\_config.py in <module>
124 use_pygeos = Option(
125 key="use_pygeos",
--> 126 default_value=_default_use_pygeos(),
127 doc=(
128 "Whether to use PyGEOS to speed up spatial operations. The default is True "
G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\_config.py in _default_use_pygeos()
110
111 def _default_use_pygeos():
--> 112 import geopandas._compat as compat
113
114 return compat.USE_PYGEOS
G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\_compat.py in <module>
147 RTREE_GE_094 = False
148 try:
--> 149 import rtree # noqa
150
151 HAS_RTREE = True
G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\__init__.py in <module>
7 __version__ = '0.9.7'
8
----> 9 from .index import Rtree, Index # noqa
G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\index.py in <module>
4 import pprint
5
----> 6 from . import core
7
8 import pickle
G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\core.py in <module>
73
74 # load the shared library by looking in likely places
---> 75 rt = finder.load()
76
77 rt.Error_GetLastErrorNum.restype = ctypes.c_int
G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\finder.py in load()
65 finally:
66 os.environ['PATH'] = oldenv
---> 67 raise OSError("could not find or load {}".format(lib_name))
68
69 elif os.name == 'posix':
OSError: could not find or load spatialindex_c-64.dll
'''
Does anyone know how to fix this? I looked up the paths and saw, that the core.py data had similar codes as requested, but the **64** was missing at the end of the spatialindex_c-.dll
您的rtree
安裝已損壞。 您可以嘗試重新安裝它或使用pygeos
代替。
推薦的方式(因為我看到你正在使用 conda):
conda install rtree -c conda-forge
或者
conda install pygeos -c conda-forge
使用 pygeos,不使用 rtree,因此不會引發錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.