python setup.py install 忽略 install_requires [英] python setup.py install ignores install_requires

查看:99
本文介绍了python setup.py install 忽略 install_requires的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用 setup.py

这是项目结构:

my-project/
  lib/
     local1/
        local1.1.0.whl
        index.html
     local2/
        local2.1.0.whl
        index.html
  setup.py

setup.py

import os

from setuptools import setup

setup(name='my project',
      version='1.0',
      description='my project',
      install_requires=[
        'lxml >= 4.3.0',
        'local1 @ file://localhost/{}/lib/local1/local1.1.0.whl'.format(os.getcwd()),
        'local2 @ file://localhost/{}/lib/local2/local2.2.0.whl'.format(os.getcwd()),
      ]
      )

如果我将依赖项放在 requirements.txt 文件中并使用 pip install -r requirements.txt --extra-index-url lib/,我可以安装,但我想知道为什么不能执行 python setup.py install 或者我遗漏了什么.

I can install if I put the dependencies in a requirements.txt file and use pip install -r requirements.txt --extra-index-url lib/, but I want to know why is it not possible to do python setup.py install or if I am missing something.

这是我得到的错误 -

No local packages or working download links found for local2@ file://localhost//Users/anusha/Documents/my-project/lib/local2/local2.1.0.whl
error: Could not find suitable distribution for Requirement.parse('local2@ file://localhost//Users/anusha/Documents/my-project/lib/local2/local2.1.0.whl')

在搜索时,我在 github 上发现了这个问题,但没有给我关于它如何工作的任何指示或解决方案.

On searching, I found this issue on github, but does not give me any pointers or solution as to how it worked.

欢迎任何帮助,提前致谢!

Any help is welcome, thanks in advance!

推荐答案

注意这个 pganssle 在 setuptools 的问题跟踪器中讨论Setuptools install failed with PEP508 URLs"的评论:

Note this comment from pganssle in the discussion "Setuptools install fails with PEP508 URLs" in setuptools's issue tracker:

我们迄今为止的政策是,如果使用 pip install 解决了您的问题,您应该使用 pip install,我们不会解决问题.

Our policy to date has been that if using pip install fixes your problem, you should use pip install and we won't fix the issue.

我相信这与 Python 社区中打包工具和技术的当前演变是一致的.因此,如果您的基于 setuptools 的具有此要求符号的项目可以通过 pip install .pip install --editable . 安装,那么请看进一步.

I believe this is in line with the current evolution of the packaging tools and techniques in the Python community. So if your setuptools-based project with this requirement notation can be installed via pip install . and pip install --editable ., then look no further.

这篇关于python setup.py install 忽略 install_requires的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆