Easiest way to automatically download required modules in Python?

守給你的承諾、 提交于 2019-12-03 05:44:12

问题


I would like to release a python module I wrote which depends on several packages. What's the easiest way to make it so these packages are programmatically downloaded just in case they are not available on the system that's being run? Most of these modules should be available by easy_install or pip or something like that. I simply want to avoid having the user install each module separately.

thanks.


回答1:


pip uses requirements files, which have a very straightforward format.

For more Python packaging tooling recommendations, see the latest from the Python Packaging Authority (PyPA).




回答2:


See the setuptools docs on how to declare your dependencies -- this will allow easy_install to find, download and install all of them (and transitive closure thereof) if everything's available in PyPi, or otherwise if you specify the dependencies' URLs.



来源:https://stackoverflow.com/questions/2634874/easiest-way-to-automatically-download-required-modules-in-python

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