如何在pip中安装具有公共依赖项的私有模块?

时间:2013-01-11 23:26:49

标签: python pip pypi

我找到了一些与dependency_links相关的答案,但遗憾的是它们还没有为我工作。我正在写一个python模块。它存储在私有pypi仓库中,并依赖于存储在同一私有仓库和public pypi repository中的一些依赖项:

setup(
# some other setup
name = 'mymodule',
install_requires = [
    'kazoo',
    'privateDependencyA',
    'privateDependencyB'
],
dependency_links = [
    "http://my.private.repo/eggs/#privateDependencyA",
    "http://my.private.repo/eggs/#privateDependencyB"
])

我将mymodule存储在我的私有存储库中,因此我尝试安装它:

pip install -i http://my.private.repo/eggs/ mymodule

这很好,但找不到kazoo,这是一个公共图书馆。因此,我尝试-f标志:

$ pip install -i http://my.private.repo/eggs/ -f http://pypi.python.org/ mymodule                                                                                                                                                                                                                                      
Downloading/unpacking mymodule
  Downloading mymoudle-<version>.tar.gz (unknown size): 3.1kB downloaded
  Running setup.py egg_info for package mymodule

Downloading/unpacking kazoo (from mymodule)
  Could not find any downloads that satisfy the requirement kazoo (from mymodule)

Downloading/unpacking kazoo (from mymodule)
  Could not find any downloads that satisfy the requirement kazoo (from mymodule)

如何从公共pypi存储库下载依赖项,同时从我的私有库中安装我的模块?

1 个答案:

答案 0 :(得分:2)

--extra-index-url http://pypi.python.org/simple添加到您的命令中。它会首先查看http://my.private.repo/eggs/,然后查看http://pypi.python.org/simple

http://www.pip-installer.org/en/latest/usage.html#alternate-package-repositories

查看更多信息