[PyOV] Fix finding libs on windows (#13902)

* [PyOV] Fix finding libs on windows

* exclude install pkg dirs

* undo changes in setup.cfg

* change the logic
This commit is contained in:
Anastasia Kuporosova authored and GitHub committed 2022-11-10 21:32:47 +01:00
1 parent 63e24773ee
commit 96d835244c
1 file changed
+14 -8
+14 -8
View File
@@ -16,20 +16,26 @@ def add_openvino_libs_to_path() -> None:
#
# If you're using a custom installation of openvino,
# add the location of openvino dlls to your system PATH.
#
# looking for the libs in the pip installation path by default.
openvino_libs = [os.path.join(os.path.dirname(__file__), "libs")]
# setupvars.bat script set all libs paths to OPENVINO_LIB_PATHS environment variable.
openvino_libs_installer = os.getenv("OPENVINO_LIB_PATHS")
if openvino_libs_installer:
openvino_libs.extend(openvino_libs_installer.split(";"))
openvino_libs = []
# looking for the libs in the pip installation path.
if os.path.isdir(os.path.join(os.path.dirname(__file__), "libs")):
openvino_libs.append(os.path.join(os.path.dirname(__file__), "libs"))
else:
# setupvars.bat script set all libs paths to OPENVINO_LIB_PATHS environment variable.
openvino_libs_installer = os.getenv("OPENVINO_LIB_PATHS")
if openvino_libs_installer:
openvino_libs.extend(openvino_libs_installer.split(";"))
else:
sys.exit("Error: Please set the OPENVINO_LIB_PATHS environment variable. "
"If you use an install package, please, run setupvars.bat")
for lib in openvino_libs:
lib_path = os.path.join(os.path.dirname(__file__), lib)
if os.path.isdir(lib_path):
os.environ["PATH"] = os.path.abspath(lib_path) + ";" + os.environ["PATH"]
# On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.
if (3, 8) <= sys.version_info:
os.add_dll_directory(os.path.abspath(lib_path))
else:
os.environ["PATH"] = os.path.abspath(lib_path) + ";" + os.environ["PATH"]
def deprecated(version: str = "", message: str = "") -> Callable[..., Any]: