Including direct dependency download links in setup.py

江枫思渺然 提交于 2019-12-10 23:32:39

问题


Can one specify direct download links for Python egg dependencies?

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

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


回答1:


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

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

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



来源:https://stackoverflow.com/questions/11646110/including-direct-dependency-download-links-in-setup-py

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!