实在是被hdbscan和bertopic的依赖库版本不匹配给搞晕了,索性直接重新搭建一个环境,从头开始
首先,在Anaconda prompt中输入以下代码新建环境、激活环境:
conda create --name BERTopic_Env python=3.8 #3.8基本够用了,3.9很多库的版本不匹配
activate BERTopic_Env
其次,在新环境中添加清华镜像:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
再次,pip debug --verbose查看当前环境,从
https://www.lfd.uci.edu/~gohlke/pythonlibs/#hdbscan上手动下载hdbscan whl文件,放在anaconda\pkgs文件夹中,在anaconda prompt中cd转入相应文件夹后,输入:
pip install hdbscan-0.8.28-cp38-cp38-win_amd64.whl
此时,已成功安装hdbscan库(不用手动安装相关依赖库,它会自动安装)。
最后,输入
pip install bertopic
安装bertopic成功!!
附:hdbscan 0.8.28依赖库:
cython-0.29.32
joblib-1.2.0
numpy-1.23.5
scikit-learn-1.1.3
scipy-1.9.3
threadpool ctl-3.1.0
bertopic部分依赖库:
umap-learn-0.5.3
plotly>=4.7.0
hdbscan>=0.8.28
numpy>=1.20.0
scikit-learn>=0.22.2.post1
cython>=0.27
joblib>=1.0
…