error in qpth setup command: ‘install_requires‘ must be a string or list of strings 解决方案

问题描述

今天在执行pip install qpth时,遇到了以下bug:

$ pip install qpth
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting qpth
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e1/d5/cb0aefa287767726e6e20b0b3774517feaaca11c775c0069824b4c68d1e8/qpth-0.0.15.tar.gz (11 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [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: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

这说明qpth的setup.py写的有问题。博主本来想找到下载下来的tar.gz解包后再修改的,奈何执行全局搜索也没有找到qpth相关的包,执行

conda run python -m pip cache dir

返回/root/.cache/pip,在这个文件夹里也没有找到。决定按照报错提供的链接地址下载后上传至服务器,修改setup.py后手动pip。

解决方案

下载链接:

https://pypi.tuna.tsinghua.edu.cn/packages/e1/d5/cb0aefa287767726e6e20b0b3774517feaaca11c775c0069824b4c68d1e8/qpth-0.0.15.tar.gz

将该压缩包上传至服务器并使用以下命令解压缩:

tar -vxzf qpth-0.0.15.tar.gz

进入该文件夹,打开setup.py文件,将报错中的

numpy>=1<2

改为

numpy>=1

然后执行

python setup.py install

成功安装qpth。 

参考链接

https://www.saoniuhuo.com/question/detail-2665945.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值