1
我每次尝试做任何涉及kd-tree的操作时都会看到以下错误。奇怪的是,就在几天前,这个代码工作正常,并且在我的同事的机器上仍然正常工作(我们使用相同的回购)。Scipy kd-tree实现抛出“负向尺寸”
它似乎无论什么我通过英寸
任何人都可以提供任何见解发生的呢?
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
你知道传递给最后一个return语句的数组是什么吗? – rofls
'np.ndindex'已经发生了变化,它似乎以前支持负值。然而,尽管失败没有什么值得惊讶的,但我觉得奇怪的是,它会因为负面的维度错误而失败。 'array_to_query'的形状是什么? (它是一个已知的问题,'np.ndindex'需要一些改变) – seberg
我不确定发生了什么事情,但sudo pip卸载numpy和scipy并强制重新安装这两者似乎已经做到了! – isthmuses