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

pip安装qpth报错‘install_requires必须为字符串’的原因及排查

qpth包pip安装失败问题排查与原因解释

问题场景

在Windows系统的Python虚拟环境中执行pip install qpth时安装失败,报错指向依赖版本解析错误。

报错信息

(venv) PS C:\Dev\python\my_test> pip install qpth
Collecting qpth
  Installing build dependencies ... done
  error: subprocess-exited-with-error
  × Getting requirements to build wheel did not run successfully.
  ╰─> [3 lines of output]
      error in qpth setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
          numpy>=1<2
               ~~~^
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

环境配置

OS Windows, Python 3.11.1
pip in c:\dev\python\my_test\venv\lib\site-packages (23.1.2)
setuptools in c:\dev\python\my_test\venv\lib\site-packages (67.7.2)

原因分析

报错核心是qpth包的setup.py文件中,install_requires字段里的numpy版本规范numpy>=1<2不符合新版setuptools的语法要求。新版setuptools(及配套pip)要求多条件的版本范围必须用逗号分隔,比如numpy>=1,<2,旧的紧凑写法>=1<2已不再被支持,导致依赖解析失败。

解决方法

  • 降级setuptools到兼容旧版本规范的版本,执行命令:
    pip install setuptools==58.0.4
    
    之后再次尝试pip install qpth
  • 手动修改qpth源码的依赖规范:
    1. 下载qpth的源码包
    2. 打开setup.py文件,将numpy>=1<2修改为numpy>=1,<2
    3. 在源码目录下执行pip install .完成安装
  • 寻找并安装已修复该问题的qpth fork版本

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 17:45:09