Shapely OSError: Could not find lib c or load any of its variants []

前端 未结 5 1299
自闭症患者
自闭症患者 2021-02-20 01:16

I\'m just trying to use the demo code. I run the following in Jupyter Notebook:

from shapely.geometry import shape

Which gives me the following:

相关标签:
5条回答
  • 2021-02-20 02:04

    You may try to reset the environment variable DYLD_FALLBACK_LIBRARY_PATH:

    export DYLD_FALLBACK_LIBRARY_PATH=$(HOME)/lib:/usr/local/lib:/lib:/usr/lib
    

    Source

    0 讨论(0)
  • 2021-02-20 02:06

    @user2977865 and @anothernode are correct in their approach but it may not work for everyone. By default, shapely will look for libraries in the DYLD_PATH.

    I had it set to DYLD_LIBRARY_PATH=/usr/local/lib/:/usr/local/mysql/lib/

    But these libraries are placed in /usr/lib.

    So I had to modify it as follows:

    export DYLD_LIBRARY_PATH=/usr/lib/:/usr/local/mysql/lib/
    

    Bonus note: Ensure that your environment variables have been set by restarting terminal and clearing cache of any IDEs you might be using.

    0 讨论(0)
  • 2021-02-20 02:12

    The way I fixed it:

    apk add geos libc-dev musl-dev
    pip install Shapely
    
    0 讨论(0)
  • 2021-02-20 02:13

    For me, only works after installing Shapely from the shapely lib and executing the following command from Anaconda Prompt:

    pip install Shapely-1.7.1-cp37-cp37m-win_amd64.whl --force-reinstall
    

    This forces a re-install of shapely.

    0 讨论(0)
  • 2021-02-20 02:19

    I simply uninstalled Shapely and re-installed it to fix the issue.

    python -m pip uninstall shapely
    
    python -m pip install shapely
    
    0 讨论(0)
提交回复
热议问题