From 96aa9642245a9d5575a79176442cf12c960fb061 Mon Sep 17 00:00:00 2001 From: soulteary Date: Wed, 14 Sep 2022 11:11:37 +0800 Subject: [PATCH] fix: Automatic installation when the dependent package does not exist --- milvus/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/milvus/__init__.py b/milvus/__init__.py index b162e43..4164e80 100644 --- a/milvus/__init__.py +++ b/milvus/__init__.py @@ -6,8 +6,12 @@ import pathlib import shutil import os -from importlib_resources import files from distutils.dir_util import copy_tree +try: + from importlib_resources import files +except ModuleNotFoundError: + os.system("pip install importlib_resources") +from importlib_resources import files CONFIG_PATH = '/var/bin/e-milvus/configs/' LIB_PATH = '/var/bin/e-milvus/lib/'