导入SentenceTransformer遇ImportError:numpy版本不达标求助
解决SentenceTransformer导入时的numpy版本错误
错误信息:
ImportError: numpy>=1.17 is required for a normal functioning of this module, but found numpy==1.16.5.
Try: pip install transformers -U or pip install -e '.[dev]' if you're working with git main
以下是可行的解决步骤:
- 直接升级numpy到符合要求的版本,执行命令:
pip install numpy>=1.17 -U - 若升级numpy后仍有问题,尝试升级sentence_transformers本身:
pip install sentence_transformers -U - 如果你使用虚拟环境,务必先激活对应环境再执行上述命令,避免修改全局包依赖
- 也可以尝试错误提示里的命令:
pip install transformers -U,因为sentence_transformers依赖transformers,升级它可能同步修复依赖问题
内容的提问来源于stack exchange,提问作者Prakash Mahadole
相关产品推荐
相关产品推荐

