Python numpy 模块,get_include() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用numpy.get_include()

项目:histwords    作者:williamleif    | 项目源码 | 文件源码
def run(count_path, out_path, smooth=0, cds=True, normalize=False, neg=1):
    counts = create_representation("Explicit", count_path, normalize=False)
    old_mat = counts.m
    index = counts.wi
    smooth = old_mat.sum() * smooth

    # getting marginal probs
    row_probs = old_mat.sum(1) + smooth
    col_probs = old_mat.sum(0) + smooth
    if cds:
        col_probs = np.power(col_probs, 0.75)
    row_probs = row_probs / row_probs.sum()
    col_probs = col_probs / col_probs.sum()

    # building PPMI matrix
    ppmi_mat = make_ppmi_mat(old_mat, row_probs, col_probs, smooth, neg=neg, normalize=normalize)
    import pyximport
    pyximport.install(setup_args={"include_dirs": np.get_include()})
    from representations import sparse_io
    sparse_io.export_mat_eff(ppmi_mat.row, ppmi_mat.col, ppmi_mat.data, out_path + ".bin")
    util.write_pickle(index, out_path + "-index.pkl")
项目:skutil    作者:tgsmith61591    | 项目源码 | 文件源码
def configuration(parent_package="", top_path=None):
    config = Configuration("metrics", parent_package, top_path)

    cblas_libs, blas_info = get_blas_info()
    if os.name == 'posix':
        cblas_libs.append('m')

    config.add_extension("_kernel_fast",
                         sources=["_kernel_fast.c"],
                         include_dirs=[os.path.join('..', 'src', 'cblas'),
                                       numpy.get_include(),
                                       blas_info.pop('include_dirs', [])],
                         libraries=cblas_libs,
                         extra_compile_args=blas_info.pop('extra_compile_args',
                                                          []),
                         **blas_info)
    config.add_subpackage('tests')

    return config
项目:bolero    作者:rock-learning    | 项目源码 | 文件源码
def configuration(parent_package="", top_path=None):
    import os
    from numpy.distutils.misc_util import Configuration
    import numpy

    libraries = []
    if os.name == 'posix':
        libraries.append('m')

    config = Configuration("utils", parent_package, top_path)

    config.add_extension("_ranking_svm",
                         sources=["_ranking_svm.c"],
                         include_dirs=[numpy.get_include()],
                         libraries=libraries,
                         extra_compile_args=["-O3"])

    config.set_options(ignore_setup_xxx_py=True,
                       assume_default_configuration=True,
                       delegate_options_to_subpackages=True,
                       quiet=True)
    return config
项目:modl    作者:arthurmensch    | 项目源码 | 文件源码
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration

    config = Configuration('decomposition', parent_package, top_path)

    extensions = [
        Extension('modl.decomposition.dict_fact_fast',
                  sources=['modl/decomposition/dict_fact_fast.pyx'],
                  include_dirs=[numpy.get_include()],
                  ),
        Extension('modl.decomposition.recsys_fast',
                  sources=['modl/decomposition/recsys_fast.pyx'],
                  include_dirs=[numpy.get_include()],
                  ),
    ]
    config.ext_modules += extensions

    config.add_subpackage('tests')

    return config
项目:modl    作者:arthurmensch    | 项目源码 | 文件源码
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration

    config = Configuration('input_data', parent_package, top_path)

    extensions = [
                  Extension('modl.input_data.image_fast',
                            sources=['modl/input_data/image_fast.pyx'],
                            include_dirs=[numpy.get_include()]
                            ),
                  ]
    config.add_subpackage('tests')
    config.add_subpackage('fmri')

    config.ext_modules += extensions

    return config
项目:SlackBuilds    作者:montagdude    | 项目源码 | 文件源码
def include_dirs_hook():
        if sys.version_info[0] >= 3:
            import builtins
            if hasattr(builtins, '__NUMPY_SETUP__'):
                del builtins.__NUMPY_SETUP__
            import imp
            import numpy
            imp.reload(numpy)
        else:
            import __builtin__
            if hasattr(__builtin__, '__NUMPY_SETUP__'):
                del __builtin__.__NUMPY_SETUP__
            import numpy
            reload(numpy)

        ext = Extension('test', [])
        ext.include_dirs.append(numpy.get_include())
        if not has_include_file(
                ext.include_dirs, os.path.join("numpy", "arrayobject.h")):
            warnings.warn(
                "The C headers for numpy could not be found. "
                "You may need to install the development package")

        return [numpy.get_include()]
项目:polylearn    作者:scikit-learn-contrib    | 项目源码 | 文件源码
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration

    config = Configuration('polylearn', parent_package, top_path)

    config.add_extension('loss_fast', sources=['loss_fast.cpp'],
                         include_dirs=[numpy.get_include()])

    config.add_extension('cd_direct_fast', sources=['cd_direct_fast.cpp'],
                         include_dirs=[numpy.get_include()])

    config.add_extension('cd_linear_fast', sources=['cd_linear_fast.cpp'],
                         include_dirs=[numpy.get_include()])

    config.add_extension('cd_lifted_fast', sources=['cd_lifted_fast.cpp'],
                         include_dirs=[numpy.get_include()])

    config.add_subpackage('tests')

    return config
项目:mujoco-py    作者:openai    | 项目源码 | 文件源码
def __init__(self, mjpro_path):
        self.mjpro_path = mjpro_path
        self.extension = Extension(
            'mujoco_py.cymj',
            sources=[join(self.CYMJ_DIR_PATH, "cymj.pyx")],
            include_dirs=[
                self.CYMJ_DIR_PATH,
                join(mjpro_path, 'include'),
                np.get_include(),
            ],
            libraries=['mujoco150'],
            library_dirs=[join(mjpro_path, 'bin')],
            extra_compile_args=[
                '-fopenmp',  # needed for OpenMP
                '-w',  # suppress numpy compilation warnings
            ],
            extra_link_args=['-fopenmp'],
            language='c')
项目:cykdtree    作者:cykdtree    | 项目源码 | 文件源码
def get_include():
    """
    Return the directory that contains the NumPy \\*.h header files.
    Extension modules that need to compile against NumPy should use this
    function to locate the appropriate include directory.
    Notes
    -----
    When using ``distutils``, for example in ``setup.py``.
    ::
        import numpy as np
        ...
        Extension('extension_name', ...
                include_dirs=[np.get_include()])
        ...
    """
    import cykdtree
    return os.path.dirname(cykdtree.__file__)
项目:spfeas    作者:jgrss    | 项目源码 | 文件源码
def setup_package():

    metadata = dict(name=spfeas_name,
                    maintainer=maintainer,
                    maintainer_email=maintainer_email,
                    description=description,
                    license=license_file,
                    version=__version__,
                    long_description=long_description,
                    author=author_file,
                    packages=get_packages(),
                    package_data=get_package_data(),
                    ext_modules=cythonize(get_pyx_list()),
                    include_dirs=[np.get_include()],
                    cmdclass=dict(build_ext=build_ext),
                    zip_safe=False,
                    download_url=git_url,
                    install_requires=required_packages,
                    entry_points=get_console_dict())

    setup(**metadata)
项目:pyramid    作者:tgsmith61591    | 项目源码 | 文件源码
def configuration(parent_package="", top_path=None):
    cblas_libs, blas_info = get_blas_info()

    libraries = []
    if os.name == 'posix':
        cblas_libs.append('m')
        libraries.append('m')

    config = Configuration("arima", parent_package, top_path)
    config.add_extension("_arima",
                         sources=["_arima.pyx"],
                         include_dirs=[numpy.get_include(),
                                       blas_info.pop('include_dirs', [])],
                         libraries=libraries,
                         extra_compile_args=blas_info.pop(
                             'extra_compile_args', []),
                         **blas_info)

    config.add_subpackage('tests')

    return config
项目:gamtools    作者:pombo-lab    | 项目源码 | 文件源码
def run(self):

        # Check numpy is installed before trying to find the location
        # of numpy headers

        try:
            import numpy
        except ImportError:
            raise ImportError('numpy need to be installed before GAMtools can be '
                              'compiled. Try installing with "pip install numpy" '
                              'before installing GAMtools.')

        self.include_dirs.append(numpy.get_include())

        build_ext.run(self)

# Utility function to read the README file.
# Used for the long_description.  It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
项目:Parallel-SGD    作者:angadgill    | 项目源码 | 文件源码
def configuration(parent_package="", top_path=None):
    config = Configuration("decomposition", parent_package, top_path)

    libraries = []
    if os.name == 'posix':
        libraries.append('m')

    config.add_extension("_online_lda",
                         sources=["_online_lda.c"],
                         include_dirs=[numpy.get_include()],
                         libraries=libraries)

    config.add_extension('cdnmf_fast',
                         sources=['cdnmf_fast.c'],
                         include_dirs=[numpy.get_include()],
                         libraries=libraries)

    config.add_subpackage("tests")

    return config
项目:Parallel-SGD    作者:angadgill    | 项目源码 | 文件源码
def configuration(parent_package="", top_path=None):
    config = Configuration("manifold", parent_package, top_path)
    libraries = []
    if os.name == 'posix':
        libraries.append('m')
    config.add_extension("_utils",
                         sources=["_utils.c"],
                         include_dirs=[numpy.get_include()],
                         libraries=libraries,
                         extra_compile_args=["-O3"])
    cblas_libs, blas_info = get_blas_info()
    eca = blas_info.pop('extra_compile_args', [])
    eca.append("-O4")
    config.add_extension("_barnes_hut_tsne",
                         libraries=cblas_libs,
                         sources=["_barnes_hut_tsne.c"],
                         include_dirs=[join('..', 'src', 'cblas'),
                                       numpy.get_include(),
                                       blas_info.pop('include_dirs', [])],
                         extra_compile_args=eca, **blas_info)

    return config
项目:Parallel-SGD    作者:angadgill    | 项目源码 | 文件源码
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration

    config = Configuration('sparsetools', parent_package, top_path)

    config.add_extension('_traversal',
                         sources=['_traversal.c'],
                         include_dirs=[numpy.get_include()],
                         #libraries=libraries
                         )
    config.add_extension('_graph_tools',
                         sources=['_graph_tools.c'],
                         include_dirs=[numpy.get_include()],
                         #libraries=libraries
                         )

    return config
项目:zipline-chinese    作者:zhanghan1990    | 项目源码 | 文件源码
def __getitem__(self, key):
        if key != 'build_ext':
            return super(LazyBuildExtCommandClass, self).__getitem__(key)

        from Cython.Distutils import build_ext as cython_build_ext
        import numpy

        # Cython_build_ext isn't a new-style class in Py2.
        class build_ext(cython_build_ext, object):
            """
            Custom build_ext command that lazily adds numpy's include_dir to
            extensions.
            """
            def build_extensions(self):
                """
                Lazily append numpy's include directory to Extension includes.

                This is done here rather than at module scope because setup.py
                may be run before numpy has been installed, in which case
                importing numpy and calling `numpy.get_include()` will fail.
                """
                numpy_incl = numpy.get_include()
                for ext in self.extensions:
                    ext.include_dirs.append(numpy_incl)

                super(build_ext, self).build_extensions()
        return build_ext
项目:polo    作者:adrianveres    | 项目源码 | 文件源码
def run(self):
        # Make sure the compiled Cython files in the distribution are up-to-date
        from Cython.Build import cythonize
        cythonize(['polo.pyx'], include_dirs=[numpy.get_include()])
        _sdist.run(self)
项目:histwords    作者:williamleif    | 项目源码 | 文件源码
def run(word_gen, index, window_size, out_file):
    context = []
    pair_counts = Counter()
    for word in word_gen:
        context.append(index[word])
        if len(context) > window_size * 2 + 1:
            context.pop(0)
        pair_counts = _process_context(context, pair_counts, window_size)
    import pyximport
    pyximport.install(setup_args={"include_dirs": np.get_include()})
    from representations import sparse_io
    sparse_io.export_mat_from_dict(pair_counts, out_file)
项目:histwords    作者:williamleif    | 项目源码 | 文件源码
def load_matrix(f):
    if not f.endswith('.bin'):
        f += ".bin"
    import pyximport
    pyximport.install(setup_args={"include_dirs": np.get_include()})
    from representations import sparse_io
    return sparse_io.retrieve_mat_as_coo(f).tocsr()
项目:radar    作者:amoose136    | 项目源码 | 文件源码
def test_include_dirs(self):
        # As a sanity check, just test that get_include
        # includes something reasonable.  Somewhat
        # related to ticket #1405.
        include_dirs = [np.get_include()]
        for path in include_dirs:
            assert_(isinstance(path, (str, unicode)))
            assert_(path != '')
项目:radar    作者:amoose136    | 项目源码 | 文件源码
def get_include():
    """
    Return the directory that contains the NumPy \\*.h header files.

    Extension modules that need to compile against NumPy should use this
    function to locate the appropriate include directory.

    Notes
    -----
    When using ``distutils``, for example in ``setup.py``.
    ::

        import numpy as np
        ...
        Extension('extension_name', ...
                include_dirs=[np.get_include()])
        ...

    """
    import numpy
    if numpy.show_config is None:
        # running from numpy source directory
        d = os.path.join(os.path.dirname(numpy.__file__), 'core', 'include')
    else:
        # using installed numpy core headers
        import numpy.core as core
        d = os.path.join(os.path.dirname(core.__file__), 'include')
    return d
项目:radar    作者:amoose136    | 项目源码 | 文件源码
def get_numpy_include_dirs():
    # numpy_include_dirs are set by numpy/core/setup.py, otherwise []
    include_dirs = Configuration.numpy_include_dirs[:]
    if not include_dirs:
        import numpy
        include_dirs = [ numpy.get_include() ]
    # else running numpy/core/setup.py
    return include_dirs
项目:brainiak    作者:brainiak    | 项目源码 | 文件源码
def finalize_options(self):
        super().finalize_options()
        import numpy
        import pybind11
        self.include_dirs.extend([
            numpy.get_include(),
            pybind11.get_include(user=True),
            pybind11.get_include(),
        ])
项目:integration-prototype    作者:SKA-ScienceDataProcessor    | 项目源码 | 文件源码
def run(self):
        """Overridden method. Runs the build.
        Library directories and include directories are checked here, first.
        """
        # Add the numpy include directory.
        self.include_dirs.insert(0, get_include())

        # Call the base class method.
        build_ext.run(self)
项目:fastxml    作者:Refefer    | 项目源码 | 文件源码
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include())
项目:catalyst    作者:enigmampc    | 项目源码 | 文件源码
def __getitem__(self, key):
        if key != 'build_ext':
            return super(LazyBuildExtCommandClass, self).__getitem__(key)

        from Cython.Distutils import build_ext as cython_build_ext
        import numpy

        # Cython_build_ext isn't a new-style class in Py2.
        class build_ext(cython_build_ext, object):
            """
            Custom build_ext command that lazily adds numpy's include_dir to
            extensions.
            """

            def build_extensions(self):
                """
                Lazily append numpy's include directory to Extension includes.

                This is done here rather than at module scope because setup.py
                may be run before numpy has been installed, in which case
                importing numpy and calling `numpy.get_include()` will fail.
                """
                numpy_incl = numpy.get_include()
                for ext in self.extensions:
                    ext.include_dirs.append(numpy_incl)

                super(build_ext, self).build_extensions()

        return build_ext
项目:bolero    作者:rock-learning    | 项目源码 | 文件源码
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration

    config = Configuration("wrapper", parent_package, top_path)
    try:
        import build_info
    except ImportError:
        build_info = None
    if build_info is None:
        config.set_options(ignore_setup_xxx_py=True,
                           assume_default_configuration=True,
                           delegate_options_to_subpackages=True,
                           quiet=True)
        return config

    from Cython.Build import cythonize
    import numpy

    cythonize(cython_path("_wrapper.pyx"), language="c++")

    # CMake outputs multiple include dirs separated by ";"
    # but the setup scripts needs it as list => split it
    config.add_extension(
        '_wrapper',
        sources=["_wrapper.cpp"],  # Generated by cythonize
        include_dirs=[".",
                      numpy.get_include(),
                      build_info.BOLERO_INCLUDE_DIRS.split(";"),
                      build_info.BL_LOADER_INCLUDE_DIRS.split(";"),
                      build_info.LIB_MANAGER_INCLUDE_DIRS.split(";")],
        libraries=["bl_loader", "lib_manager"],
        library_dirs=[build_info.BL_LOADER_LIBRARY_DIRS.split(";"),
                      build_info.LIB_MANAGER_LIBRARY_DIRS.split(";")],
        define_macros=[("NDEBUG",)],
        extra_compile_args=["-O3", "-Wno-unused-function",
                            "-Wno-unused-but-set-variable",])
    return config
项目:jwalk    作者:jwplayer    | 项目源码 | 文件源码
def ext_modules():
    import numpy

    walks_ext = Extension('jwalk.walks', ['jwalk/src/walks.pyx'],
                          include_dirs=[numpy.get_include()])

    return [walks_ext]
项目:pydpc    作者:cwehmeyer    | 项目源码 | 文件源码
def extensions():
    from numpy import get_include
    from Cython.Build import cythonize
    ext_core = Extension(
        "pydpc.core",
        sources=["ext/core.pyx", "ext/_core.c"],
        include_dirs=[get_include()],
        extra_compile_args=["-O3", "-std=c99"])
    exts = [ext_core]
    return cythonize(exts)
项目:krpcScripts    作者:jwvanderbeck    | 项目源码 | 文件源码
def test_include_dirs(self):
        # As a sanity check, just test that get_include
        # includes something reasonable.  Somewhat
        # related to ticket #1405.
        include_dirs = [np.get_include()]
        for path in include_dirs:
            assert_(isinstance(path, (str, unicode)))
            assert_(path != '')
项目:krpcScripts    作者:jwvanderbeck    | 项目源码 | 文件源码
def get_include():
    """
    Return the directory that contains the NumPy \\*.h header files.

    Extension modules that need to compile against NumPy should use this
    function to locate the appropriate include directory.

    Notes
    -----
    When using ``distutils``, for example in ``setup.py``.
    ::

        import numpy as np
        ...
        Extension('extension_name', ...
                include_dirs=[np.get_include()])
        ...

    """
    import numpy
    if numpy.show_config is None:
        # running from numpy source directory
        d = os.path.join(os.path.dirname(numpy.__file__), 'core', 'include')
    else:
        # using installed numpy core headers
        import numpy.core as core
        d = os.path.join(os.path.dirname(core.__file__), 'include')
    return d
项目:krpcScripts    作者:jwvanderbeck    | 项目源码 | 文件源码
def get_numpy_include_dirs():
    # numpy_include_dirs are set by numpy/core/setup.py, otherwise []
    include_dirs = Configuration.numpy_include_dirs[:]
    if not include_dirs:
        import numpy
        include_dirs = [ numpy.get_include() ]
    # else running numpy/core/setup.py
    return include_dirs
项目:hydpy    作者:tyralla    | 项目源码 | 文件源码
def compile_(self):
        """Translate cython code to C code and compile it."""
        from Cython import Build
        argv = copy.deepcopy(sys.argv)
        sys.argv = [sys.argv[0], 'build_ext', '--build-lib='+self.buildpath]
        exc_modules = [
                distutils.extension.Extension(
                        'hydpy.cythons.autogen.'+self.cyname,
                        [self.cyfilepath], extra_compile_args=['-O2'])]
        distutils.core.setup(ext_modules=Build.cythonize(exc_modules),
                             include_dirs=[numpy.get_include()])
        sys.argv = argv
项目:yt    作者:yt-project    | 项目源码 | 文件源码
def finalize_options(self):
        try:
            import cython
            import numpy
        except ImportError:
            raise ImportError(
"""Could not import cython or numpy. Building yt from source requires
cython and numpy to be installed. Please install these packages using
the appropriate package manager for your python environment.""")
        if LooseVersion(cython.__version__) < LooseVersion('0.24'):
            raise RuntimeError(
"""Building yt from source requires Cython 0.24 or newer but
Cython %s is installed. Please update Cython using the appropriate
package manager for your python environment.""" %
                cython.__version__)
        if LooseVersion(numpy.__version__) < LooseVersion('1.10.4'):
            raise RuntimeError(
"""Building yt from source requires NumPy 1.10.4 or newer but
NumPy %s is installed. Please update NumPy using the appropriate
package manager for your python environment.""" %
                numpy.__version__)
        from Cython.Build import cythonize
        self.distribution.ext_modules[:] = cythonize(
                self.distribution.ext_modules)
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process
        # see http://stackoverflow.com/a/21621493/1382869
        if isinstance(__builtins__, dict):
            # sometimes this is a dict so we need to check for that
            # https://docs.python.org/3/library/builtins.html
            __builtins__["__NUMPY_SETUP__"] = False
        else:
            __builtins__.__NUMPY_SETUP__ = False
        self.include_dirs.append(numpy.get_include())
项目:modl    作者:arthurmensch    | 项目源码 | 文件源码
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration

    config = Configuration('randomkit', parent_package, top_path)
    libs = []
    if sys.platform == 'win32':
        libs.append('Advapi32')

    extensions = [Extension('modl.utils.randomkit.random_fast',
                            sources=['modl/utils/randomkit/random_fast.pyx',
                                     'modl/utils/randomkit/randomkit.c',
                                     'modl/utils/randomkit/distributions.c',
                                     ],
                            language="c++",
                            include_dirs=[numpy.get_include(),
                                          'modl/utils/randomkit'],
                            ),
                  Extension('modl.utils.randomkit.sampler',
                            sources=['modl/utils/randomkit/sampler.pyx'],
                            language="c++",
                            include_dirs=[numpy.get_include()]
                            )]
    config.ext_modules += extensions

    config.add_subpackage('tests')

    return config
项目:modl    作者:arthurmensch    | 项目源码 | 文件源码
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration

    config = Configuration('math', parent_package, top_path)

    extensions = [Extension('modl.utils.math.enet',
                            sources=['modl/utils/math/enet.pyx'],
                            include_dirs=[numpy.get_include()],
                            ),
                  ]
    config.ext_modules += extensions

    config.add_subpackage('tests')

    return config
项目:xtensor-python-cookiecutter    作者:QuantStack    | 项目源码 | 文件源码
def __str__(self):
        import pybind11
        return pybind11.get_include(self.user)
项目:xtensor-python-cookiecutter    作者:QuantStack    | 项目源码 | 文件源码
def __str__(self):
        import numpy as np
        return np.get_include()
项目:bezier    作者:dhermes    | 项目源码 | 文件源码
def extension_modules():
    import numpy as np

    libraries, library_dirs = BuildFortranThenExt.get_library_dirs()
    extensions = []
    for name, dependencies in FORTRAN_MODULES.items():
        if name in ('types', 'status'):  # No speedup.
            continue

        mod_name = 'bezier._{}_speedup'.format(name)
        path = SPEEDUP_FILENAME.format(name)
        if BuildFortranThenExt.USE_SHARED_LIBRARY:
            # Here we don't depend on object files since the functionality
            # is contained in the shared library.
            extra_objects = []
        else:
            # NOTE: These may be treated as relative paths and replaced
            #       before the extension is actually built.
            extra_objects = [
                OBJECT_FILENAME.format(dependency)
                for dependency in dependencies
            ]
        # NOTE: Copy ``libraries`` and ``library_dirs`` so they
        #       aren't shared (and mutable) between extensions.
        extension = setuptools.Extension(
            mod_name,
            [path],
            extra_objects=extra_objects,
            include_dirs=[
                np.get_include(),
                os.path.join('src', 'bezier', 'include'),
            ],
            libraries=copy.deepcopy(libraries),
            library_dirs=copy.deepcopy(library_dirs),
        )
        extensions.append(extension)

    return extensions
项目:robotpy-cscore    作者:robotpy    | 项目源码 | 文件源码
def __str__(self):
        import pybind11
        return pybind11.get_include(self.user)
项目:robotpy-cscore    作者:robotpy    | 项目源码 | 文件源码
def __str__(self):
        import numpy as np
        return np.get_include()

# As of Python 3.6, CCompiler has a `has_flag` method.
# cf http://bugs.python.org/issue26689
项目:numpythia    作者:scikit-hep    | 项目源码 | 文件源码
def finalize_options(self):
        global libnumpythia
        #global external_fastjet
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process
        try:
            del builtins.__NUMPY_SETUP__
        except AttributeError:
            pass
        import numpy
        libnumpythia.include_dirs.append(numpy.get_include())
项目:pohmm    作者:vmonaco    | 项目源码 | 文件源码
def get_include():
            return os.path.join(sys.prefix, 'include')
项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda    作者:SignalMedia    | 项目源码 | 文件源码
def get_numpy_include_dirs():
    # numpy_include_dirs are set by numpy/core/setup.py, otherwise []
    include_dirs = Configuration.numpy_include_dirs[:]
    if not include_dirs:
        import numpy
        include_dirs = [ numpy.get_include() ]
    # else running numpy/core/setup.py
    return include_dirs
项目:Python-Wrapper-for-World-Vocoder    作者:JeremyCCHsu    | 项目源码 | 文件源码
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include())

# # This can be loosen probably, though it's fine I think
# min_cython_ver = '0.24.0'
# try:
#     import Cython
#     ver = Cython.__version__
#     _CYTHON_INSTALLED = ver >= LooseVersion(min_cython_ver)
# except ImportError:
#     _CYTHON_INSTALLED = False

# try:
#     if not _CYTHON_INSTALLED:
#         raise ImportError('No supported version of Cython installed.')
#     from Cython.Distutils import build_ext
#     cython = True
# except ImportError:
#     cython = False

# if cython:
#     ext = '.pyx'
#     cmdclass = {'build_ext': build_ext}
# else:
#     ext = '.cpp'
#     cmdclass = {}
#     if not os.path.exists(join("pyworld", "pyworld" + ext)):
#         raise RuntimeError("Cython is required to generate C++ wrapper")
项目:aws-lambda-numpy    作者:vitolimandibhrata    | 项目源码 | 文件源码
def test_include_dirs(self):
        # As a sanity check, just test that get_include
        # includes something reasonable.  Somewhat
        # related to ticket #1405.
        include_dirs = [np.get_include()]
        for path in include_dirs:
            assert_(isinstance(path, (str, unicode)))
            assert_(path != '')
项目:aws-lambda-numpy    作者:vitolimandibhrata    | 项目源码 | 文件源码
def get_include():
    """
    Return the directory that contains the NumPy \\*.h header files.

    Extension modules that need to compile against NumPy should use this
    function to locate the appropriate include directory.

    Notes
    -----
    When using ``distutils``, for example in ``setup.py``.
    ::

        import numpy as np
        ...
        Extension('extension_name', ...
                include_dirs=[np.get_include()])
        ...

    """
    import numpy
    if numpy.show_config is None:
        # running from numpy source directory
        d = os.path.join(os.path.dirname(numpy.__file__), 'core', 'include')
    else:
        # using installed numpy core headers
        import numpy.core as core
        d = os.path.join(os.path.dirname(core.__file__), 'include')
    return d
项目:aws-lambda-numpy    作者:vitolimandibhrata    | 项目源码 | 文件源码
def get_numpy_include_dirs():
    # numpy_include_dirs are set by numpy/core/setup.py, otherwise []
    include_dirs = Configuration.numpy_include_dirs[:]
    if not include_dirs:
        import numpy
        include_dirs = [ numpy.get_include() ]
    # else running numpy/core/setup.py
    return include_dirs
项目:soft-dtw    作者:mblondel    | 项目源码 | 文件源码
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration

    config = Configuration('sdtw', parent_package, top_path)

    config.add_extension('soft_dtw_fast', sources=['soft_dtw_fast.c'],
                         include_dirs=[numpy.get_include()])

    config.add_subpackage('tests')

    return config
项目:preconditioned_GPs    作者:mauriziofilippone    | 项目源码 | 文件源码
def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

# cos_module_np = Extension('cos_module_np',
#                      sources=['PcgComp/kernels/cos_module_np.c'],
#                      include_dirs=[numpy.get_include()])