From 41a6297d55b5dc336e9c406f87c5740ae6dd224a Mon Sep 17 00:00:00 2001 From: channingss Date: Wed, 11 Sep 2019 19:23:24 +0800 Subject: [PATCH] add code for check onnxruntime version --- x2paddle/onnx_infer.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/x2paddle/onnx_infer.py b/x2paddle/onnx_infer.py index d37c431..8d6b0f2 100644 --- a/x2paddle/onnx_infer.py +++ b/x2paddle/onnx_infer.py @@ -1,4 +1,3 @@ -import onnxruntime as rt import os import sys import numpy as np @@ -19,6 +18,17 @@ def arg_parser(): def main(): + try: + import onnxruntime as rt + version = rt.__version__ + if version != '0.4.0': + print("onnxruntime==0.4.0 is required") + return + except: + print( + "onnxruntime is not installed, use \"pip install onnxruntime==0.4.0\"." + ) + return parser = arg_parser() args = parser.parse_args() -- GitLab