【问题标题】:easy_install -f vs easy_install -ieasy_install -f 与 easy_install -i
【发布时间】:2009-10-18 14:54:41
【问题描述】:

这与我不久前提出的this 问题有关。

最终的结果是我希望能够安装我的包“identity.model”和所有依赖项。就这样……

$ easy_install -f http://eggs.sadphaeton.com identity.model
Searching for identity.model
Reading http://eggs.sadphaeton.com
Reading http://pypi.python.org/simple/identity.model/
Couldn't find index page for 'identity.model' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for identity.model
error: Could not find suitable distribution for Requirement.parse('identity.model')

无论出于何种原因,运行此 easy_install 都会访问我根据 this information 布置的主页

我的 index.html

<html>
 <head>
     <title>SadPhaeton Egg Repository</title>
 </head>
 <body>
    <a rel="homepage" href="AlchemyExtra">AlchemyExtra</a>
    <a rel="homepage" href="identity.model">identity.model</a>
    <a rel="homepage" href="repoze.what.plugins.config">repoze.what.plugins.config</a>

 </body>
</html>

如果我跑...

$ easy_install -i http://eggs.sadphaeton.com identity.model

它确实找到了我的包和我放在那里的 repoze.what.plugins.config,因为它是一个依赖项。但是,当它去获取 tw.forms(托管在 pypi 上的外部依赖项)时,它以失败告终,因为它只搜索了 http://eggs.sadphaeton.com

显然我误解了“规范”。有人知道诀窍是什么吗?

【问题讨论】:

    标签: python setuptools


    【解决方案1】:

    -f 将获取你给它的 url,并在那里寻找包,以及在 PyPI 上。这种页面的一个例子是http://dist.plone.org/release/3.3.1/ 如您所见,这是一个分发文件列表。

    使用 -i 定义主索引页面。默认为http://pypi.python.org/simple/ 如您所见,索引页是包的索引,而不是分发文件的索引。

    因此,在您的情况下,easy_install -i http://eggs.sadphaeton.com identity.model 应该可以下载 identity.model。它对我有用,就像中间两次,但不是第一次也不是第二次。我不知道您是否正在尝试不同的格式?但无论如何,它会在 tw.forms 上失败,因为它不在您的索引页面上。

    所以解决方案应该是制作一个像http://dist.plone.org/release/3.3.1/ 这样的页面,上面有你的鸡蛋。我不知道格式必须有多精确,但我认为它非常灵活。

    更新:

    这里是一步解决的步骤:

    1. 将所有发行版放在一个目录中。
    2. cd 到那个目录。
    3. 输入python -c "from SimpleHTTPServer import test; test()"
    4. 现在输入easy_install -f http://localhost:8080/ &lt;modulename&gt;

    它将安装模块。

    【讨论】:

    • 看起来你引用的索引和我的索引之间的区别是那些都是源分布所以我想知道是不是鸡蛋的分布使这更难。旁注:看起来 webfaction 没有为鸡蛋正确设置 mime-type,我认为这也会导致 pip 失败。
    • 不,主要区别在于它在一页上列出了所有发行版,即所有可用文件。您列出了软件包,而不是发行版。 identity.model,与 identity.model-0.0dev-py2.6.egg。此外,您的文件的内容类型错误,这也可能是不同的。
    • 换句话说,Plone 列表只不过是所有鸡蛋的目录列表,文件名链接到文件。我不知道 rel="download" 是否相关,但 Plone 列表中没有它,PyPI 索引也没有。
    • 但 pypi 确实有子目录。例如对于 Toscawidgets,easy_install 会点击 Reading pypi.python.org/simple/ToscaWidgets Reading toscawidgets.org Reading toscawidgets.org/download 并且此页面 pypi.python.org/simple/ToscaWidgets 不仅仅是一个目录列表。这就是我想要理解的所有内容。
    • 对,但子目录是用于带有 -i 的索引的。然后你替换 PyPI 甚至不阅读它,然后你需要在那里拥有所有包,而不仅仅是你自己的。这真的很简单:将所有包粘贴在一个目录中,并为其启用直接列出。完成。
    【解决方案2】:

    看来诀窍在于在根目录的 index.html 上有 rel="download" 链接。

    <html>
    <head>
        <title>SadPhaeton Egg Repository</title>
    </head>
    <body>
        <a rel="homepage" href="AlchemyExtra">AlchemyExtra</a> <a rel="download" href="AlchemyExtra/AlchemyExtra-0.0dev-py2.6.egg">download</a><br>
        <a rel="homepage" href="identity.model">identity.model</a> <a rel="download" href="identity.model/identity.model-0.0dev-py2.6.egg">download</a><br>
    
        <a rel="homepage" href="repoze.what.plugins.config">repoze.what.plugins.config</a> <a rel="download" href="repoze.what.plugins.config/repoze.what.plugins.config-0.0.0-py2.6.egg">download</a><br>
    
    </body>
    </html>
    

    这解决了我的直接问题,但如果规范中有更多详细信息会很好。根据我阅读的内容,我期待 easy_install 会咨询主页以获取下载链接,但它似乎不想为我这样做。

    现在以某种方式自动执行此操作,因为手动执行此废话是 PITA。

    【讨论】:

    • 使用您的网络服务器创建目录列表,并将所有鸡蛋粘贴到该目录中。那应该这样做。我很确定 Plone 列表只是一个列出目录的 nginx。
    【解决方案3】:

    问题是你试图混合使用 -i 和 -f 模式来制作你的页面;您需要选择其中一个,因为rel="" 的东西 与 -i 一起使用。

    如果你想使用 -f 模式,那么你只需要一个包含鸡蛋的 webserver 目录。如果你想使用 -i,那么你必须为每个项目创建一个包含 index.html 的子目录,并且这些 index.html 文件将包含 rel="homepage" 内容。

    【讨论】:

      猜你喜欢
      • 2011-07-31
      • 1970-01-01
      • 2014-04-29
      • 2012-10-03
      • 1970-01-01
      • 1970-01-01
      • 2016-11-06
      • 2014-04-09
      • 1970-01-01
      相关资源
      最近更新 更多