You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下PyCharm用Conda安装Flair遇subprocess报错,如何解决?

Windows下安装Flair报错的解决方法

在Windows系统的PyCharm中,使用Conda环境安装Flair时出现报错,切换到venv环境后问题依旧。具体报错信息翻译如下:

error: subprocess-exited-with-error

× python setup.py egg_info 运行失败。
│ 退出码: 1
╰─> [17行输出]
回溯(最近的调用最后):
文件 "", 第2行, in
文件 "", 第34行, in
文件 "C:\Users\fateh\AppData\Local\Temp\pip-install-u0mlt8t3\sentencepiece_a000aad54e31418080721464f45f1b0d\setup.py", 第126行, in
subprocess.check_call([
文件 "C:\Users\fateh\miniconda3\Lib\subprocess.py", 第408行, in check_call
retcode = call(*popenargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
文件 "C:\Users\fateh\miniconda3\Lib\subprocess.py", 第389行, in call
with Popen(*popenargs, **kwargs) as p:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
文件 "C:\Users\fateh\miniconda3\Lib\subprocess.py", 第1026行, in init
self._execute_child(args, executable, preexec_fn, close_fds,
文件 "C:\Users\fateh\miniconda3\Lib\subprocess.py", 第1538行, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] 系统找不到指定的文件
[输出结束]

note: 该错误来自子进程,大概率不是pip的问题。
error: metadata-generation-failed

× 生成包元数据时遇到错误。
╰─> 查看上面的输出详情。

note: 这是上述包的问题,不是pip的问题。

解决办法

  • 优先安装预编译的sentencepiece包
    报错根源是pip尝试从源码编译sentencepiece时找不到编译相关文件,直接安装预编译的二进制包即可解决:
    激活你的环境后,在PyCharm终端执行:

    pip install sentencepiece --only-binary :all:
    

    完成后再安装Flair:

    pip install flair
    
  • 安装编译依赖(如果需要源码编译)
    若预编译包无法满足需求,需确保系统具备C++编译环境:

    • 下载安装Visual Studio Build Tools,勾选「C++开发工具」组件,包含MSVC编译器和Windows SDK
    • 重启PyCharm和终端,让环境变量生效后重新尝试安装
  • 指定兼容版本安装
    新版本可能存在兼容性问题,尝试降级到稳定版本:

    pip install flair==0.12.2 sentencepiece==0.1.99
    

内容的提问来源于stack exchange,提问作者marwen fateh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 12:28:11