无法导入 Shapely(Ubuntu、Python) [英] Cannot import Shapely (Ubuntu, Python)
问题描述
我下载了 Shapely 来做一些多边形工作(在 Ubuntu AWS 实例上).一切都安装得很好,我使用了 wget.当我第一次遇到我要解释的错误时,我也做了 pip,但它只是说一切都在那里,所以我认为下载不是问题.
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.
无论如何,当我尝试导入任何from匀称的东西时,我得到这个错误:
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
当我只是说导入匀称"时,一切都很好.但是,当我需要从库的更深处导入任何内容时,它会崩溃.我首先用 from shapely.geometry import polygon
尝试了它,但对于包内的任何东西都是一样的.有没有人之前遇到过这个问题/知道解决方案?
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?
推荐答案
在 Ubuntu 上,显然你总是应该使用 sudo apt-get install
来获取库等.当我执行 wget
或 pip install
时,我只是将文件粘贴在一个随机位置,而不是我的实际路径中.
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.
所以,我想总是使用 sudo apt-get install
...
So, I guess always use sudo apt-get install
...
这篇关于无法导入 Shapely(Ubuntu、Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!