m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.5 KiB

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