成功解决ValueError: setting an array element with a sequence. The requested array has an...

背景:
这个问题是在使用scipy和numpy处理数据时出现的
scipy的版本为1.9.1
numpy的版本为1.25.0
而scipy=1.9.1时,与其匹配的numpy版本为
[1.18.5, 1.25.0)
左闭右开

如果不匹配的话
在使用np.array将list转为array时会报错

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (16, 3) + inhomogeneous part.

此时,需要重新安装一个匹配的numpy就可以了。

猜你喜欢

转载自blog.csdn.net/JingpengSun/article/details/131464163