Skip to main content
 首页 » 编程设计

python之在 zc.buildout 中从私有(private) pypi 安装包

2025年05月04日26tintown

我正在尝试使用 zc.buildout 从私有(private) reportlab pypi 服务器安装 python 包。

当我使用他们自己网站上提供的说明进行安装时,安装没有问题。 http://www.reportlab.com/reportlabplus/installation/

但是,如果我使用 zc.buildout 安装,我会一直收到 Couldn't find distributions for 'rlextra'。我将他们的 pypi 存储库添加到 find-links,所以我不确定我遗漏了什么。

我的构建配置:

[buildout] 
versions = versions 
include-site-packages = false 
extensions = mr.developer 
unzip = true 
 
find-links = https://[user]:[pass]@www.reportlab.com/pypi 
 
parts = 
    python 
    django 
    compass-config 
 
auto-checkout = * 
 
eggs = 
    ... 
    rlextra 
    ... 
 
... etc. 

编辑:我应该指出,我最终确实手动下载了该包,并在我的构建中将其用作开发包。尽管这解决了眼前的问题,但我仍然想知道为什么我的原始设置不起作用。

请您参考如下方法:

您正在为 find-links URL 传递 PyPI 主链接,但是 find-links 仅适用于简单的索引样式页面(每个包都存在于PyPI)。

例如,beautifulsoup4 包在 https://pypi.python.org/simple/beautifulsoup4/ 有一个简单的索引页面。

ReportLab 服务器也有简单的页面;将此包的一个添加到您的构建中:

find-links = https://[user]:[pass]@www.reportlab.com/pypi/simple/rlextra/ 

IIRC 您还可以添加顶级 https://[user]:[pass]@www.reportlab.com/pypi/simple URL 作为查找链接,但更多特定于 URL 往返的保存。