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

使用pip安装OpenVino-dev时遭遇error: legacy-install-failure错误

解决OpenVINO-dev安装时的legacy-install-failure(numpy相关)

问题详情

执行 pip install openvino-dev[ONNX,tensorflow2] 安装OpenVINO开发包时,反复触发 error: legacy-install-failure 错误,错误日志显示问题根源在numpy包的安装环节。已尝试升级并重装wheel、setuptools和pip,问题仍未解决。完整错误输出如下:

[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.
numpy
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

可行解决方案

  • 预安装兼容版本的numpy
    OpenVINO对numpy版本有明确兼容范围,版本不匹配会导致编译失败。先安装一个经官方验证的稳定版本,再执行OpenVINO安装命令:

    pip install numpy==1.26.4
    pip install openvino-dev[ONNX,tensorflow2]
    

    提示:可根据你安装的OpenVINO版本调整numpy版本,比如2024.1版本支持numpy 1.21.6至1.26.x

  • 补充系统编译依赖
    numpy源码安装需要对应系统的编译工具链,缺失会触发安装失败:

    • Linux系统:
      sudo apt-get update && sudo apt-get install gcc g++ python3-dev
      
    • Windows系统:安装Visual Studio Build Tools并勾选C++开发组件
    • macOS系统:
      xcode-select --install
      
  • 强制使用numpy二进制包
    跳过源码编译环节,强制pip使用预编译的numpy二进制包:

    pip install numpy --only-binary :all:
    pip install openvino-dev[ONNX,tensorflow2]
    
  • 用虚拟环境隔离依赖
    全局Python环境的依赖冲突可能引发安装问题,创建独立虚拟环境后重新操作:

    # 创建虚拟环境
    python -m venv openvino_env
    # Windows激活环境
    openvino_env\Scripts\activate
    # Linux/macOS激活环境
    source openvino_env/bin/activate
    # 升级依赖管理工具
    pip install --upgrade pip wheel setuptools
    # 安装OpenVINO-dev
    pip install openvino-dev[ONNX,tensorflow2]
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.13 13:05:27