From ad7c53bafad01ac272a615552411daa19ca9162a Mon Sep 17 00:00:00 2001 From: Hu Shiwen Date: Thu, 21 May 2020 03:15:32 +0800 Subject: [PATCH] Fix windows dll search path in python 3.8 (#18362) --- python/mxnet/libinfo.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/mxnet/libinfo.py b/python/mxnet/libinfo.py index fccf136e1769..ea674acb638f 100644 --- a/python/mxnet/libinfo.py +++ b/python/mxnet/libinfo.py @@ -20,7 +20,7 @@ import os import platform import logging - +import sys def find_lib_path(prefix='libmxnet'): """Find MXNet dynamic library files. @@ -73,6 +73,11 @@ def find_lib_path(prefix='libmxnet'): 'List of candidates:\n' + str('\n'.join(dll_path))) if os.name == 'nt': os.environ['PATH'] = os.environ['PATH'] + ';' + os.path.dirname(lib_path[0]) + if sys.version_info >= (3, 8): + if 'CUDA_PATH' not in os.environ: + raise RuntimeError('Cannot find the env CUDA_PATH.Please set CUDA_PATH env with cuda path') + os.add_dll_directory(os.path.dirname(lib_path[0])) + os.add_dll_directory(os.path.join(os.environ['CUDA_PATH'], 'bin')) return lib_path def find_include_path():