错误:无法为 fasttext 构建轮子,这是安装基于 pyproject.toml 的项目所必需的

问题描述 投票:0回答:2

我正在尝试在 python 3.11.4 中使用

fasttext
安装
pip install fasttext
,但在构建轮子时遇到了麻烦。错误如下:

      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fasttext
  Running setup.py clean for fasttext
Failed to build fasttext
ERROR: Could not build wheels for fasttext, which is required to install pyproject.toml-based projects

我在网上搜索过,大多数点击表明该错误与 Visual Studio 的构建工具有关(上面的错误也表明了这一点)。我已经安装/更新了所有构建工具,并且还按照here的建议安装了最新的 SDK,但错误仍然存在。

以前有人解决过这个问题吗?可以分享任何可能的解决方案吗?

python python-wheel fasttext
2个回答
1
投票

有些人报告说设法在 Windows 上编译 Facebook 的

fasttext
包,也许@phd 评论中提到的问题会有一些对你有用的提示。

但请注意,该项目的官方主页https://github.com/facebookresearch/fastText仅表示“一般来说,fastText 构建在现代 Mac OS 和 Linux 发行版上”——没有提及官方 Windows 支持。

因此,除了使用解决方法之外,一些选项还可以包括:

  • 切换操作系统(这可能有助于其他可能在 Windows 之外得到更好支持的软件包)
  • 使用替代的 FastText 实现,例如
    gensim
    包中的实现 - 它与核心 fasttext 单词建模相匹配(甚至还有一些附加选项),但错过了 Facebook 实现中的一些内容(主要是
    supervised
    模式和单词 n -克)。

0
投票

使用

pip install fasttext-wheel
代替为我解决了问题。

© www.soinside.com 2019 - 2024. All rights reserved.