当前位置: 首页>>代码示例>>Python>>正文


Python os.add_dll_directory方法代码示例

本文整理汇总了Python中os.add_dll_directory方法的典型用法代码示例。如果您正苦于以下问题:Python os.add_dll_directory方法的具体用法?Python os.add_dll_directory怎么用?Python os.add_dll_directory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在os的用法示例。


在下文中一共展示了os.add_dll_directory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import os [as 别名]
# 或者: from os import add_dll_directory [as 别名]
def __init__(self):
            try:
                if platform.system() == 'Darwin':
                    self.c_khiva_library = ctypes.CDLL('libkhiva_c.dylib')
                elif platform.system() == 'Windows':
                    if sys.version_info.major == 3 and sys.version_info.minor == 8:
                        import os
                        os.add_dll_directory(os.getenv("KHIVA_DLL_DIR", default=r'C:\Program Files\Khiva\v0\lib'))
                    self.c_khiva_library = ctypes.CDLL('khiva_c.dll')
                elif platform.system() == 'Linux':
                    self.c_khiva_library = ctypes.CDLL('libkhiva_c.so')
            except:
                raise Exception("Khiva C++ library is required in order to use the Python Khiva library") 
开发者ID:shapelets,项目名称:khiva-python,代码行数:15,代码来源:library.py

示例2: configure_windows

# 需要导入模块: import os [as 别名]
# 或者: from os import add_dll_directory [as 别名]
def configure_windows():
    """
    Validate that KfW appears to be installed correctly and add it to the
    DLL directories/PATH if necessary. In the case that it can't be located,
    raise an error.
    """
    if kfw_available():
        return  # All set, necessary DLLs should be available

    if os.path.exists(KFW_BIN):  # In standard location
        try:  # to use Python 3.8's DLL handling
            os.add_dll_directory(KFW_BIN)
        except AttributeError:  # <3.8, use PATH
            os.environ['PATH'] += os.pathsep + KFW_BIN
        if kfw_available():
            return

    # Check if kinit is in the PATH which should lead us to the bin folder
    kinit_path = shutil.which('kinit')  # KfW provided binary
    if kinit_path:  # Non-standard install location
        try:  # Most likely >=3.8, otherwise it would have been found already
            os.add_dll_directory(os.path.dirname(kinit_path))
        except AttributeError:  # <3.8, corrupted installation?
            pass
        else:
            if kfw_available():
                return

    error_not_found() 
开发者ID:pythongssapi,项目名称:python-gssapi,代码行数:31,代码来源:_win_config.py

示例3: _setup_win32_dll_directory

# 需要导入模块: import os [as 别名]
# 或者: from os import add_dll_directory [as 别名]
def _setup_win32_dll_directory():
    cuda_path = get_cuda_path()
    if cuda_path is None:
        raise RuntimeError('CUDA path could not be detected.')
    os.add_dll_directory(os.path.join(cuda_path, 'bin')) 
开发者ID:cupy,项目名称:cupy,代码行数:7,代码来源:_environment.py


注:本文中的os.add_dll_directory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。