[英]How to auto install missing module in python?
I want to release my simple python script which use some extended module such as argparse
and watchdog
. 我想发布使用一些扩展模块(例如
argparse
和watchdog
简单python脚本。 I don't think it reasonable to make the assumption that user of my script already has these modules installed. 我认为假设我的脚本用户已经安装了这些模块是不合理的。 So I think I should include a configure script to test user environment (if I can automatically install these missing modules, that couldn't be better:P) in the release.
因此,我认为我应该在发行版中包含一个配置脚本来测试用户环境(如果我可以自动安装这些缺少的模块,那再好不过了:P)。
My question is: is there any utilities like configure
for c program. 我的问题是:是否有任何实用程序,例如为c程序
configure
。 If no such things, is it possible to adapt configure
to python environment? 如果没有这样的东西,是否有可能使
configure
适应python环境? Otherwise I have to compose some from scratch:(. 否则,我必须从头开始撰写一些内容:(。
Thanks and best regards. 谢谢和最好的问候。
查看setuptools ,特别是此文档。
use PIP with a text file stating all required modules. 使用带有说明所有必需模块的文本文件的PIP。 like so:
像这样:
pip install -r requirement.txt
see: http://www.pip-installer.org/en/latest/requirements.html 请参阅: http : //www.pip-installer.org/en/latest/requirements.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.