Cannot import Shapely (Ubuntu, Python)

拜拜、爱过 提交于 2019-12-24 08:39:37

问题


I downloaded Shapely to do some polygon work (on a Ubuntu AWS instance). Everything installed just fine, I used wget. I also did pip when I first encountered the error I'm about to explain, but it just said everything was there, so I don't think the download is the issue.

Anyway, when I try to import anything from shapely, I get this error:

OSError: libgeos_c.so: cannot open shared object file: No such file or directory

When I just say "import shapely", it all goes fine. However, when I need to import anything from deeper in the library, it crashes. I first tried it with from shapely.geometry import polygon but it's the same for anything from within the package. Has anyone had this problem before/know the solution?


回答1:


On Ubuntu, apparently you're always supposed to use sudo apt-get install to get libraries and such. When I did wget or pip install, I was just sticking the files in a random spot, not in my actual path.

So, I guess always use sudo apt-get install...



来源:https://stackoverflow.com/questions/19279656/cannot-import-shapely-ubuntu-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!