【问题标题】:libspatialindex and Rtree on pythonpython上的libspatialindex和Rtree
【发布时间】:2015-04-14 00:09:10
【问题描述】:

好的,所以我正在尝试将libspatialspatialindex 安装到我的 Ubuntu 机器 python。我确实按照所有说明操作并从http://packages.ubuntu.com/lucid/libspatialindex1 下载了libspatialindex1_1.4.0-1.1_amd64.deb 并下载了它的amd64 版本,因为我的机器是64 位机器。我安装了它然后跳转到Rtree python https://pypi.python.org/pypi/Rtree 下载并安装Rtree in python。我按照文件夹内 install.txt 文件中给出的安装说明进行操作。它说通过$ python setup.py install 运行本地 setup.py 我也这样做了,但之后我得到的是

`root@ubuntu:/# cd /home/neelabh/Desktop/Rtree
root@ubuntu:/home/neelabh/Desktop/Rtree# python setup.py install
Traceback (most recent call last):
File "setup.py", line 4, in <module>
import rtree
File "/home/neelabh/Desktop/Rtree/rtree/__init__.py", line 1, in <module>
from .index import Rtree
File "/home/neelabh/Desktop/Rtree/rtree/index.py", line 6, in <module>
from . import core
File "/home/neelabh/Desktop/Rtree/rtree/core.py", line 110, in <module>
rt.Error_GetLastErrorNum.restype = ctypes.c_int
File "/usr/lib/python2.7/ctypes/__init__.py", line 378, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: Error_GetLastErrorNum`

谁能帮我解决这个问题!

我真的提前感谢!

【问题讨论】:

  • 可能使用了错误的目录?

标签: python-2.7 ubuntu python-3.x spatial-index r-tree


【解决方案1】:

您必须使用系统包管理器安装包“libspatialindex-dev”。至少我的系统 (Mint 17.1) 是这样,它应该 100% 兼容默认的 Ubuntu 安装。

【讨论】:

  • 谢谢。还有几个库丢失了。但问题得到了解决。
  • 这对我有用,应该是公认的答案!
  • 也适用于 ubuntu 18.04。谢谢朋友。
  • 也解决了ubuntu 20.04上的问题。谢谢!
【解决方案2】:

你必须在你的ubuntu系统中安装libspatialindex-dev。这里我使用的是 ubuntu 16.04 或 18.04

sudo apt update

sudo apt install libspatialindex-dev

使用你的 python pip 版本安装 Rtree,我有 pip 3.7

pip3.7 install Rtree

import rtree

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-23
    • 2021-09-21
    • 2018-06-25
    • 1970-01-01
    • 1970-01-01
    • 2020-12-13
    • 2021-05-23
    • 1970-01-01
    相关资源
    最近更新 更多