如果我运行下面的代码:如果我改变b += c
到b = b + c
,代码运行正常在numpy数组上使用就地操作时生成的TypeError?
TypeError: ufunc 'add' output (typecode 'O') could not be coerced to provided
output parameter (typecode 'd') according to the casting rule ''same_kind''
:
import numpy as np
b = np.zeros(1)
c = np.zeros(1)
c = c/2**63
print b, c
b += c
我收到此错误信息。为什么这样?我在RHEL上运行Python 2.7.2。
NumPy的版本:2.0.0.dev-a2a9dfb
GCC版本:4.1.2 20080704(红帽4.1.2-52)
预先感谢您。
请发布您的numpy版本('print np.version.version')和'gcc --version'(来自shell),因为我们需要bug报告的信息。 –
我同样有'/ ='这个问题。感谢您解决它的后。 –