Including direct dependency download links in setu

2019-07-16 12:11发布

问题:

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