ImportError: Could not import sentence_transformers python package.
在win11系统中,明明conda环境中已经安装了conda list中是存在这个库的,但还是报以下的错误。按照安装指示重新安装也无果。
ImportError: Could not import sentence_transformers python package.
1. 问题
在win11系统中,明明conda环境中已经安装了sentence_transformers
,conda list
中是存在这个库的,但还是报以下的错误。
ImportError: Could not import sentence_transformers python package. Please install it with
pip install sentence-transformers
.
按照安装指示pip install sentence-transformers
重新安装也无果。
2. 解决方案
2.1 Step 1
尝试升级sentence_transformers
无果,于是卸载sentence_transformers
,重新安装sentence_transformers
。
# 卸载
pip uninstall sentence_transformers
# 安装
pip install sentence_transformers
安装了sentence-transformers 4.0.2。
2.2 Step 2
但还是在导入import sentence_transformers
发现pandas
库有问题,无法导入pandas。但conda list
发现pandas
也是安装过了。
ImportError: Could not import pandas
遂,卸载了pandas
,重新安装。
# 卸载
conda uninstall pandas
# 安装
conda install pandas
2.3 Step 3
最后,在导入import sentence_transformers
依然报错“ImportError: DLL load failed while importing lib: 找不到指定的程序”,但实际发现是pyarrow
库有问题。
直接升级pyarrow库。
pip install -U pyarrow
直接升级pyarrow库,我在升级到pyarrow-19.0.0后导入sentence_transformers
成功。
更多推荐
所有评论(0)