从自定义索引setup.py安装 [英] Installing from custom index setup.py
问题描述
我是一个程序包的程序包维护者,该程序包依赖于我们自己的pip存储库中托管的程序包.
I am the package maintainer of a package that has dependencies to packages hosted in our own pip repository.
我希望在执行pip install mypackage
时也要安装这些软件包.
I want these packages to also be installed when doing pip install mypackage
.
setup(
name='mypackage',
version='1.1.2',
description='My awesome package',
dependency_links=[
'http://www.myrepo.se/packages/mydep1/',
'http://www.myrepo.se/packages/mydep2/'
]
install_requires=[
'mydep1==1.0.0',
'mydep2==5.6.7'
]
)
回购中的文件夹结构如下:
The folder structure in the repo is the following:
packages/
mydep1/
mydep1-1.0.0.tar.gz
mydep2/
mydep2-5.5.1.tar.gz
mydep2-5.6.7.tar.gz
全部根据该问题的公认答案在setup.py
All according to the accepted answer on this question Using an extra python package index url with setup.py
但是,这不起作用.我收到错误消息:
However, this does not work. I get the error:
Collecting mydep1 (from mypackage==1.1.2)
Could not find a version that satisfies the requirement mydep1 (from mypackage==1.1.2) (from versions: )
No matching distribution found for mydep1 (from mypackage==1.1.2)
当我在我的requirements.txt文件中添加了一个额外的索引URL时,我不得不将该URL添加为受信任的主机.有关系吗?我也在用python 3.5.3
When I have added an extra index url to my requirements.txt before doing it this was I had to add the url as a trusted host. Is that relevant? Also I am using python 3.5.3
我激活了pip的详细输出,甚至没有尝试从我的仓库中找到软件包.
I activated verbose output from pip and it is not even trying to find the package from my repo.
1 location(s) to search for versions of mydep1:
* https://pypi.python.org/simple/mydep1/
Getting page https://pypi.python.org/simple/mydep1/
...
推荐答案
除非您明确告知pip
,否则pip
不会处理依赖关系链接(不幸的是,这意味着mypackage的所有使用者都必须知道这样做).
It seems pip
is not processing the dependency links unless you explicitly tell it to (which unfortunately means that all consumers of mypackage must know to do so).
pip install --process-dependency-links mypackage
由于mypackage
也由同一存储库托管,这意味着使用者requirements.txt
必须看起来像
Since mypackage
is also hosted by the same repository it means that a consumers requirements.txt
must look like
--trusted-host http://www.myrepo.se/
--extra-index-url http://www.myrepo.se/packages
--process-dependency-links
mypackage==1.1.2
这篇关于从自定义索引setup.py安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!