Mac m1,rtree 0.9.7,空间索引 1.9.3,未找到符号

Mac m1, rtree 0.9.7, spatialindex 1.9.3, symbol not found

() isikkaplan@iamhere# python3 manage.py loadfixtures -s=testing fixture fixtures/knock/0_ct.json -v3
Traceback (most recent call last):
  File "/Users/isikkaplan/Desktop/code/---/-/--/manage.py", line 21, in <module>
    main()
  File "/Users/isikkaplan/Desktop/code/---/-/--/manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/alphashape/__init__.py", line 6, in <module>
    from .alphashape import alphashape
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/alphashape/alphashape.py", line 15, in <module>
    import geopandas
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/geopandas/__init__.py", line 1, in <module>
    from geopandas._config import options  # noqa
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/geopandas/_config.py", line 126, in <module>
    default_value=_default_use_pygeos(),
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/geopandas/_config.py", line 112, in _default_use_pygeos
    import geopandas._compat as compat
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/geopandas/_compat.py", line 202, in <module>
    import rtree  # noqa
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/rtree/__init__.py", line 9, in <module>
    from .index import Rtree, Index  # noqa
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/rtree/index.py", line 6, in <module>
    from . import core
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/rtree/core.py", line 77, in <module>
    rt.Error_GetLastErrorNum.restype = ctypes.c_int
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/ctypes/__init__.py", line 395, in __getattr__
    func = self.__getitem__(name)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/ctypes/__init__.py", line 400, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found

几乎所有在线答案都会导致安装我已经拥有的 spatialindex,但我不知道如何解决这个问题。

如果你像我一样使用conda环境,如果你在m1上并且不使用docker,这基本上是必需的,那么你需要通过conda为当前环境安装系统库还有。

conda install -c conda-forge libspatialindex