Scipy kd-tree实现抛出“负面维度”

时间:2012-11-06 07:56:33

标签: python numpy scipy kdtree

每次我尝试做任何涉及kd树的事情时,我都会出现以下错误。奇怪的是,就在几天前,这个代码工作正常,它仍然在我同事的机器上工作正常(我们使用相同的回购)。

无论我传递什么,似乎都会发生。

任何人都可以提供任何见解吗?

  File "filename.py", line 69, in methodname
    get_index = self.kd_tree.query(array_to_query)
  File "/Library/Python/2.7/site-packages/scipy-0.12.0.dev_ddd617d_20120920-py2.7-macosx-10.8-x86_64.egg/scipy/spatial/kdtree.py", line 425, in query
    for c in np.ndindex(retshape):
  File "/Library/Python/2.7/site-packages/numpy-1.8.0.dev_9597b1f_20120920-py2.7-macosx-10.8-x86_64.egg/numpy/lib/index_tricks.py", line 536, in __init__
    x = as_strided(_nx.zeros(1), shape=shape, strides=_nx.zeros_like(shape))
  File "/Library/Python/2.7/site-packages/numpy-1.8.0.dev_9597b1f_20120920-py2.7-macosx-10.8-x86_64.egg/numpy/lib/stride_tricks.py", line 28, in as_strided
    return np.asarray(DummyArray(interface, base=x))
  File "/Library/Python/2.7/site-packages/numpy-1.8.0.dev_9597b1f_20120920-py2.7-macosx-10.8-x86_64.egg/numpy/core/numeric.py", line 320, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: negative dimensions are not allowed

1 个答案:

答案 0 :(得分:0)

从未找到答案,但强行重新安装numpy和scipy解决了这个问题。