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


Python misc_util.get_shared_lib_extension方法代码示例

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


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

示例1: test_basic2

# 需要导入模块: from numpy.distutils import misc_util [as 别名]
# 或者: from numpy.distutils.misc_util import get_shared_lib_extension [as 别名]
def test_basic2(self):
        # Regression for #801: load_library with a full library name
        # (including extension) does not work.
        try:
            try:
                so = get_shared_lib_extension(is_python_ext=True)
                # Should succeed
                load_library('_multiarray_umath%s' % so, np.core._multiarray_umath.__file__)
            except ImportError:
                print("No distutils available, skipping test.")
        except ImportError as e:
            msg = ("ctypes is not available on this python: skipping the test"
                   " (import error was: %s)" % str(e))
            print(msg) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:16,代码来源:test_ctypeslib.py

示例2: test_basic2

# 需要导入模块: from numpy.distutils import misc_util [as 别名]
# 或者: from numpy.distutils.misc_util import get_shared_lib_extension [as 别名]
def test_basic2(self):
        # Regression for #801: load_library with a full library name
        # (including extension) does not work.
        try:
            try:
                so = get_shared_lib_extension(is_python_ext=True)
                # Should succeed
                load_library('multiarray%s' % so, np.core.multiarray.__file__)
            except ImportError:
                print("No distutils available, skipping test.")
        except ImportError as e:
            msg = ("ctypes is not available on this python: skipping the test"
                   " (import error was: %s)" % str(e))
            print(msg) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:16,代码来源:test_ctypeslib.py

示例3: load_library

# 需要导入模块: from numpy.distutils import misc_util [as 别名]
# 或者: from numpy.distutils.misc_util import get_shared_lib_extension [as 别名]
def load_library(libname, loader_path):
        if ctypes.__version__ < '1.0.1':
            import warnings
            warnings.warn("All features of ctypes interface may not work " \
                          "with ctypes < 1.0.1")

        ext = os.path.splitext(libname)[1]
        if not ext:
            # Try to load library with platform-specific name, otherwise
            # default to libname.[so|pyd].  Sometimes, these files are built
            # erroneously on non-linux platforms.
            from numpy.distutils.misc_util import get_shared_lib_extension
            so_ext = get_shared_lib_extension()
            libname_ext = [libname + so_ext]
            # mac, windows and linux >= py3.2 shared library and loadable
            # module have different extensions so try both
            so_ext2 = get_shared_lib_extension(is_python_ext=True)
            if not so_ext2 == so_ext:
                libname_ext.insert(0, libname + so_ext2)
        else:
            libname_ext = [libname]

        loader_path = os.path.abspath(loader_path)
        if not os.path.isdir(loader_path):
            libdir = os.path.dirname(loader_path)
        else:
            libdir = loader_path

        for ln in libname_ext:
            libpath = os.path.join(libdir, ln)
            if os.path.exists(libpath):
                try:
                    return ctypes.cdll[libpath]
                except OSError:
                    ## defective lib file
                    raise
        ## if no successful return in the libname_ext loop:
        raise OSError("no file with expected extension") 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:40,代码来源:ctypeslib.py

示例4: test_basic2

# 需要导入模块: from numpy.distutils import misc_util [as 别名]
# 或者: from numpy.distutils.misc_util import get_shared_lib_extension [as 别名]
def test_basic2(self):
        """Regression for #801: load_library with a full library name
        (including extension) does not work."""
        try:
            try:
                so = get_shared_lib_extension(is_python_ext=True)
                cdll = load_library('multiarray%s' % so,
                                    np.core.multiarray.__file__)
            except ImportError:
                print("No distutils available, skipping test.")
        except ImportError as e:
            msg = "ctypes is not available on this python: skipping the test" \
                  " (import error was: %s)" % str(e)
            print(msg) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:16,代码来源:test_ctypeslib.py


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