我想通过
gensim
安装
pip install gensim
python 包
但是出现这个错误,我不知道该怎么解决它。
running build_ext
building 'gensim.models.word2vec_inner' extension
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/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> gensim
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
如果您安装插件失败,
您可以从其他存储库下载它,例如:
repository取决于python的版本和系统。
例如:对于 windows 11(x64) 和 python 3.10,您应该使用此文件:gensim-4.1.2-cp310-cp310-win_amd64.whl
我在安装惊喜时也遇到了类似的问题。 请从这里下载构建工具https://visualstudio.microsoft.com/visual-cpp-build-tools/ 然后从这里安装一些东西,只需勾选这里的框即可
您遇到的错误是因为您的系统上未安装 Microsoft Visual C++ 14.0 或更高版本,而这是安装所需的
gensim
。要解决此问题:
下载并安装:转到 Microsoft C++ Build Tools 并安装它们。确保在安装过程中选择“C++ 构建工具”以及最新版本的“MSVC v142 - VS 2019 C++ x64/x86 构建工具”和“Windows 10 SDK”。
重新启动:安装后,重新启动计算机。
重新安装 gensim:在命令提示符或终端中运行
pip install gensim
。
有关更详细的解决方案,请查看此错误遗留安装失败指南。