调用BERT模型时报错 Numpy is not available
·

报错内容:
Numpy is not available
经过检测,发现是numpy和torch不对应
于是尝试升级Numpy至最新版本,发现有以下报错

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
numba 0.60.0 requires numpy<2.1,>=1.22, but you have numpy 2.2.4 which is incompatible.
然而升级时显示有以上报错,大致是因为安装的numba库的限制
于是我尝试将numba删掉再升级numpy。
为了确保安装的numpy版本是对的,我直接把原来的numpy也卸载了。注意pip和conda都卸一遍,避免版本错误
pip uninstall numpy
conda uninstall numpy
pip install numpy==1.23.5
然后安装指定版本
这里要注意的是,我用的vscode的.ipynb,原文件怎么改还是报错,但是新建一个文件,调用原来的库就能用,同样的库在原文件就报错,不知道什么问题,但至少能用
更多推荐

所有评论(0)