在setup.py中包括直接依赖项下载链接 [英] Including direct dependency download links in setup.py

查看:144
本文介绍了在setup.py中包括直接依赖项下载链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以为Python Egg依赖项指定直接下载链接吗?

Can one specify direct download links for Python egg dependencies?

我将Skype4Py作为依赖项,并且easy_install似乎无法从sourceforge.net正确下载文件(sourceforge.net问题).生成的tar文件已被加密. https://github.com/stigkj/Skype4Py/issues/3

I have Skype4Py as a dependency and easy_install seems to fail to download the file correctly from sourceforge.net (sourceforge.net issue). The resulting tar file is scrambled. https://github.com/stigkj/Skype4Py/issues/3

要变通解决此问题,我想为Skype4Py存档指定直接下载链接,以避免sourceforge.net的问题.

To work around this issue I'd like to specify a direct download link for Skype4Py archive to avoid the issues with sourceforge.net.

推荐答案

首先,我强烈建议使用pip 代替 easy_install,因为它在各个方面几乎都几乎中比较好.

First of all, I highly recommend using pip instead of easy_install as it's simply better in nearly every aspect.

您不能直接在setup.py中指定直接下载链接,但这是一件好事.应该在安装时决定在哪里寻找依赖项. Pip有一些 options 允许配置在哪里寻找软件包; --index-url--extra-index-url--find-links.但是,在您的情况下,我认为最简单的解决方案是先使用某个备用位置从其 default 位置安装无法安装的依赖项,然后像这样安装使用它的软件包:

You can't specify direct download link directly in setup.py but that's a good thing. Decision where to look for a dependency should be made at installation time. Pip has a few options allowing to configure where to look for packages; --index-url, --extra-index-url and --find-links. However in your situation I think the simplest solution would be to install the dependency that fails to install from its default location using some alternate location first and then install the package that uses it like so:

pip install alternate_location_of_dependency
pip install some_package_having_above_depedency

human_curl 包为例,该包依赖于pycurl2包.可能是:

Taking human_curl package, which depends on pycurl2 package, as an example that might be:

pip install https://github.com/pycurl2/pycurl2.github.com/archive/master.zip
pip install human_curl

这篇关于在setup.py中包括直接依赖项下载链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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