numpy报错解决

anaconda使用gensim产生numpy报错问题解决方案记录如下:
如图所示:

AttributeError: module ‘numpy’ has no attribute ‘bool’.
np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

首先第一个方向,考虑了gensim与numpy的兼容性问题,
更新了numpy版本,但是还是报错,甚至离谱的是最简单的numpy都使用不上了,最后无奈还原numpy版本.

这里顺便记录下另外一个问题。卸载了最新numpy过程中虽然成功卸载,但是又产生了一个其他的错误。如图所示:

这个解决挺简单的,主要原因就是在卸载numpy包的时候,需要关闭anaconda.
好啦,回到正轨,那接下来是如何解决的呢,首先依次卸载了numpy,scipy,gensim,然后重新安装numpy 1.23.0(首次安装的时候就是这个版本),然后再装scipy,这个会安装兼容numpy1,23.0版本的,所以直接使用pip命令装上即可。注意必须是依次装,不然后面可能还是无效卸载。
其实在装numpy的时候,还是存在一个疑惑,装最新版本的,会报如下错误,好像我的scipy已经默认只要这个版本了,可能涉及其他包的兼容问题:

好在问题解决!

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
青葱年少的头像青葱年少普通用户
上一篇 2023年6月12日
下一篇 2023年6月12日

相关推荐