Python从软件包安装子软件包 [英] Python install sub-package from package

查看:133
本文介绍了Python从软件包安装子软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从软件包中安装一些特殊的子软件包?

it is possible to install some special sub-package from package?

例如,我想使用松弛,datadog,哨兵插件(包装器)创建软件包.但是我想允许用户安装他想要的东西.

For example, I want to create package with slack, datadog, sentry plugins (wrappers). But I want to allow user what he wants to install.

赞:

pip install super_plugins --plugins slack, datadog

是否可以在不将所有插件都分离到不同软件包的情况下完成?

Can it be done without separating all plugins to different packages?

推荐答案

实际上,这很简单.这称为打包名称空间包. https://packaging.python.org/guides/packaging-namespace-packages/

Actually, It is quite simple. This is called Packaging namespace packages. https://packaging.python.org/guides/packaging-namespace-packages/

您需要做的就是将所有软件包分离为子软件包,并在安装后使用命名空间.

All you need is to separate all packages to sub - packages and after install it with a namespace.

# for all packages
pip install super_plugins

# for specific
pip install super_plugins.slack super_plugins.datadog

这篇关于Python从软件包安装子软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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