Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_pybind_state.py34 linesDownload Raw Back to capi
1# -------------------------------------------------------------------------
2# Copyright (c) Microsoft Corporation. All rights reserved.
3# Licensed under the MIT License.
4# --------------------------------------------------------------------------
5"""
6Ensure that dependencies are available and then load the extension module.
7"""
8import os
9import platform
10import warnings
11
12from . import _ld_preload  # noqa: F401
13
14if platform.system() == "Windows":
15    from . import version_info
16
17    # If on Windows, check if this import error is caused by the user not installing the 2019 VC Runtime
18    # The VC Redist installer usually puts the VC Runtime dlls in the System32 folder, but it may also be found
19    # in some other locations.
20    # TODO, we may want to try to load the VC Runtime dlls instead of checking if the hardcoded file path
21    # is valid, and raise ImportError if the load fails
22    if version_info.vs2019 and platform.architecture()[0] == "64bit":
23        system_root = os.getenv("SystemRoot") or "C:\\Windows"
24        if not os.path.isfile(os.path.join(system_root, "System32", "vcruntime140_1.dll")):
25            warnings.warn("Please install the 2019 Visual C++ runtime and then try again. "
26                          "If you've installed the runtime in a non-standard location "
27                          "(other than %SystemRoot%\\System32), "
28                          "make sure it can be found by setting the correct path.")
29
30
31
32from .onnxruntime_pybind11_state import *  # noqa
33
34 
codekingpro/portable-devtools · Team Ai