首先是直接运行 pip install bertopic
报错:ERROR: Could not build wheels for hdbscan, which is required to install pyproject.toml-based project
先更换安装命令为 pip install bertopic -i https://pypi.tuna.tsinghua.edu.cn/simple/
仍然报错,故去上方网站搜索bertopic下载到本地,运行命令
pip install "C:\Users\Helianthus\Downloads\bertopic-0.9.4-py2.py3-none-any.whl"
报错:Building wheel for hdbscan (pyproject.toml) ... error
error: subprocess-exited-with-error
观察到这样一行:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
猜测是电脑没有安装Microsoft Visual C++导致报错,故去网站
https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.x_with_Visual_Studio_2022_.28x86.2C_x64.2C_ARM.2C_ARM64.29 下载Visual Studio Community 2022
勾选Python进行下载,下载后继续运行
pip install "C:\Users\Helianthus\Downloads\bertopic-0.9.4-py2.py3-none-any.whl"
报错:ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
运行命令:
pip3 install "C:\Users\Helianthus\Downloads\bertopic-0.9.4-py2.py3-none-any.whl" --ignore-installed PyYAML
结果如下:
可以看到不管咋说bertopic已经成功安装上了,在jupyter下运行一条调试命令报错:
Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['D:\\Anaconda\\lib\\site-packages\\numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.
接下来在prompt下uninstall与install numpy时会报错
下一步将各个库更新一下再看下运行结果。。。