如何在setup.py中指定括号依赖性? [英] How to specify bracket dependencies in setup.py?

查看:101
本文介绍了如何在setup.py中指定括号依赖性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关此问题:在点子安装中,方括号是什么意思?

我有一个setup.py文件,需要安装azure[common]软件包.但是,如果我尝试:

I have a setup.py file that needs to install azure[common] package. However, if I try:

setup(
    ...
    install_requires=['azure[common]'],
    ...
)

这会导致错误:

pkg_resources.UnknownExtra: azure 4.0.0 has no such extra feature 'common'

但是,如果我这样做:

pip install 'azure[common]', then it works.


上面的实验涉及很多错误和意外行为,因此该问题不再具有实际意义.


There were a lot of bugs and unexpected behavior involved in the experiment above, so the question doens't really make sense anymore.

  1. pip中有一个错误,如果未找到额外"程序包,则会导致随机安装东西.因此,pip install 'azure[common]'根本不起作用.这个错误使我相信有这样的程序包.
  2. setuptoolspip如何从轮子安装软件包之间存在不一致的地方. setuptools安装(或似乎)仅从轮子上安装一个软件包,而pip将安装所有内容,并且如果有多个软件包,则它将安装更多.因此,pip误安装了azure.common,但是没有办法故意安装该软件包.至少,您还将获得azure.profiles以及一个伪包azure_common,该伪包实际上并不包含任何内容.
  1. There's a bug in pip which causes random stuff to be installed if "extra" package isn't found. So, pip install 'azure[common]' shouldn't have worked at all. It's an error that led me to believe there was such a package.
  2. There's an inconsistency between how setuptools and pip install packages from wheels. setuptools installs (or seems to) only install one package from a wheel, while pip will install everything, and if there are more than one package, then it will install more. So, pip was installing azure.common by mistake, but there is no way to intentionally install just that package. At the minimum, you will also get azure.profiles plus a fake package azure_common, which doesn't really contain anything.

鉴于所有这些新信息,我在此处重新提出了问题:如何使setuptools安装包含多个软件包的轮子?

Given all this new info, I reformulated the question here: How to make setuptools install a wheel containing multiple packages?

推荐答案

Azure不提供common额外依赖项. pip install azure[common]显示有关此警告.

Azure does not provide the common extra dependency. pip install azure[common] shows the warning about it.

这篇关于如何在setup.py中指定括号依赖性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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