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


Python numpy.get_numpy_include函数代码示例

本文整理汇总了Python中numpy.get_numpy_include函数的典型用法代码示例。如果您正苦于以下问题:Python get_numpy_include函数的具体用法?Python get_numpy_include怎么用?Python get_numpy_include使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_numpy_include_path

def get_numpy_include_path():
    """
    Gets the path to the numpy headers.
    """
    # We need to go through this nonsense in case setuptools
    # downloaded and installed Numpy for us as part of the build or
    # install, since Numpy may still think it's in "setup mode", when
    # in fact we're ready to use it to build astropy now.

    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)

    try:
        numpy_include = numpy.get_include()
    except AttributeError:
        numpy_include = numpy.get_numpy_include()
    return numpy_include
开发者ID:RiceMunk,项目名称:astropy-helpers,代码行数:28,代码来源:utils.py

示例2: get_numpy_include

def get_numpy_include():
    try:
        # Obtain the numpy include directory. This logic works across numpy
        # versions.
        # setuptools forgets to unset numpy's setup flag and we get a crippled
        # version of it unless we do it ourselves.
        try:
            import __builtin__  # py2
            __builtin__.__NUMPY_SETUP__ = False
        except:
            import builtins  # py3
            builtins.__NUMPY_SETUP__ = False
        import numpy as np
    except ImportError as e:
        print(e)
        print('*** package "numpy" not found ***')
        print('Simpletraj requires a version of NumPy, even for setup.')
        print('Please get it from http://numpy.scipy.org/ or install it through '
              'your package manager.')
        sys.exit(-1)
    try:
        numpy_include = np.get_include()
    except AttributeError:
        numpy_include = np.get_numpy_include()
    return numpy_include
开发者ID:hainm,项目名称:simpletraj,代码行数:25,代码来源:setup.py

示例3: setup_extension_modules

  def setup_extension_modules(self):
    """Sets up the C/C++/CUDA extension modules for this distribution.
    Create list of extensions for Python modules within the openmoc
    Python package based on the user-defined flags defined at compile time.
    """

    try:
      numpy_include = numpy.get_include()

    except AttributeError:
      numpy_include = numpy.get_numpy_include()

    # Add the NumPy include directory to the include directories
    # list for each type of compiler
    for cc in self.include_directories.keys():
      self.include_directories[cc].append(numpy_include)

    # The main openmoc extension (defaults are gcc and single precision)
    self.extensions.append(
      Extension(name = '_rksolver',
                sources = copy.deepcopy(self.sources[self.cc]),
                library_dirs = self.library_directories[self.cc],
                libraries = self.shared_libraries[self.cc],
                extra_link_args = self.linker_flags[self.cc],
                include_dirs = self.include_directories[self.cc],
                swig_opts = self.swig_flags + ['-D' + self.cc.upper()]))
开发者ID:archphy,项目名称:22.213,代码行数:26,代码来源:config.py

示例4: get_numpy_include

def get_numpy_include():
    # Obtain the numpy include directory. This logic works across numpy
    # versions.
    # setuptools forgets to unset numpy's setup flag and we get a crippled
    # version of it unless we do it ourselves.
    try:
        # Python 3 renamed the ``__builin__`` module into ``builtins``.
        # Here we import the python 2 or the python 3 version of the module
        # with the python 3 name. This could be done with ``six`` but that
        # module may not be installed at that point.
        import __builtin__ as builtins
    except ImportError:
        import builtins
    builtins.__NUMPY_SETUP__ = False
    try:
        import numpy as np
    except ImportError:
        print('*** package "numpy" not found ***')
        print("MDAnalysis requires a version of NumPy (>=1.5.0), even for setup.")
        print("Please get it from http://numpy.scipy.org/ or install it through " "your package manager.")
        sys.exit(-1)
    try:
        numpy_include = np.get_include()
    except AttributeError:
        numpy_include = np.get_numpy_include()
    return numpy_include
开发者ID:friforever,项目名称:mdanalysis,代码行数:26,代码来源:setup.py

示例5: main

def main():
    install_requires = ['pyparsing>=2.0.0']
    #if sys.version_info[0] >= 3:
    #    install_requires = ['pyparsing>=2.0.0']
    #else:
        # pyparsing >= 2.0.0 is not compatible with Python 2
    #    install_requires = ['pyparsing<2.0.0']

    ka = dict(name = "pyregion",
              version = __version__,
              description = "python parser for ds9 region files",
              author = "Jae-Joon Lee",
              author_email = "[email protected]",
              url="http://leejjoon.github.com/pyregion/",
              download_url="http://github.com/leejjoon/pyregion/downloads",
              license = "MIT",
              platforms = ["Linux","MacOS X"],
              packages = ['pyregion'],
              package_dir={'pyregion':'lib'},
              install_requires = install_requires,
              use_2to3 = False,
              )
    ka["classifiers"]=['Development Status :: 5 - Production/Stable',
                       'Intended Audience :: Science/Research',
                       'License :: OSI Approved :: MIT License',
                       'Operating System :: MacOS :: MacOS X',
                       'Operating System :: POSIX :: Linux',
                       'Programming Language :: Cython',
                       'Programming Language :: Python',
                       'Programming Language :: Python :: 3',
                       'Topic :: Scientific/Engineering :: Astronomy',
                       ]

    if WITH_FILTER:
        try:
            import numpy
        except ImportError:
            warnings.warn("numpy must be installed to build the filtering module.")
            sys.exit(1)

        try:
            numpy_include = numpy.get_include()
        except AttributeError:
            numpy_include = numpy.get_numpy_include()

        if cmdclass:
            ka["cmdclass"] = cmdclass

        ka["ext_modules"] = [ Extension("pyregion._region_filter",
                                        [PYREX_SOURCE],
                                        include_dirs=['./src',
                                                      numpy_include,
                                                      ],
                                        libraries=[],
                                        )
                              ]


    setup(**ka)
开发者ID:jhunkeler,项目名称:pyregion,代码行数:59,代码来源:setup.py

示例6: get_numpy_include

def get_numpy_include():
    """
    Obtain the numpy include directory. This logic works across numpy versions.
    """
    try:
        numpy_include = numpy.get_include()
    except AttributeError:
        numpy_include = numpy.get_numpy_include()
    return numpy_include
开发者ID:tjlane,项目名称:thor,代码行数:9,代码来源:setup.py

示例7: test_include_dirs

 def test_include_dirs(self):
     """As a sanity check, just test that get_include and
     get_numarray_include include something reasonable.  Somewhat
     related to ticket #1405."""
     include_dirs = [np.get_include(), np.get_numarray_include(),
                     np.get_numpy_include()]
     for path in include_dirs:
         assert isinstance(path, (str, unicode))
         assert path != ''
开发者ID:258073127,项目名称:MissionPlanner,代码行数:9,代码来源:test_regression.py

示例8: get_numpy_include_path

def get_numpy_include_path():
    """
    Gets the path to the numpy headers.
    """
    import numpy

    try:
        numpy_include = numpy.get_include()
    except AttributeError:
        numpy_include = numpy.get_numpy_include()
    return numpy_include
开发者ID:henrysting,项目名称:astropy,代码行数:11,代码来源:setup_helpers.py

示例9: get_numpy_include_path

def get_numpy_include_path():
    import six
    if hasattr(six.moves.builtins, '__NUMPY_SETUP__'):
        del six.moves.builtins.__NUMPY_SETUP__
    import numpy
    six.moves.reload_module(numpy)
    try:
        numpy_include = numpy.get_include()
    except AttributeError:
        numpy_include = numpy.get_numpy_include()
    return numpy_include
开发者ID:UnitedShift,项目名称:chainer,代码行数:11,代码来源:chainer_setup_build.py

示例10: get_ext_modules

def get_ext_modules(use_cython):
    from numpy import get_include as get_numpy_include
    cython_modules, cython_sources = get_cython_sources(use_cython)
    ext_modules = [
        Extension('pywt._extensions.{0}'.format(module),
                  sources=[make_ext_path(source)],
                  # Doesn't automatically rebuild if library changes
                  depends=c_lib[1]['sources'] + c_lib[1]['depends'],
                  include_dirs=[make_ext_path("c"), get_numpy_include()],
                  define_macros=c_macros + cython_macros,
                  libraries=[c_lib[0]],)
        for module, source, in zip(cython_modules, cython_sources)
    ]
    return ext_modules
开发者ID:diegobersanetti,项目名称:pywt,代码行数:14,代码来源:setup.py

示例11: __compileDistUtils__

def __compileDistUtils__(hash, includeDirs, lib_dirs, libraries, doOptimizeGcc = True, additonalSources = []):
    '''
        Compiles a inline c module with the distutils. First a swig interface is used to generated swig wrapper coder which is than compiled into a python module.
        
        @brief Compiles a inline c module with distutils.
        @param hash Name of the c, interface and module files
        @param includeDirs List of directories in which distutils looks for headers needed
        @param lib_dirs List of directories in which distutils looks for libs needed
        @param libraries List of libraries which distutils uses for binding
        @return None
    '''
    try:
        numpy_include = np.get_include()
    except AttributeError:
        numpy_include = np.get_numpy_include()
    
    includeDirs.extend([numpy_include,
                os.curdir])
    
    
    iFileName = hash + ".i"
    cFileName = hash + "."+C_FILE_SUFFIX
    cWrapFileName = hash + "_wrap."+__WRAPPER_FILE_SUFFIX__
    
    
    subprocess.check_call(["swig", "-python", "-c++", iFileName])

    
    extra_compile_args = []
    if doOptimizeGcc:
        extra_compile_args = ["-pthread","-O3","-march=native","-mtune=native"]


    sourcesList = [cFileName, cWrapFileName]
    sourcesList.extend(additonalSources)
    
    module1 = Extension('_%s' % hash,
                        sources=sourcesList,
                        library_dirs=lib_dirs,
                        libraries=libraries,
                        include_dirs=includeDirs,
                        extra_compile_args = extra_compile_args)
    
    setup (script_args=['build'],
           name='_%s' % hash,
           version='1.0',
           description='SWICE JIT lib',
           ext_modules=[module1],
           include_dirs=includeDirs)
开发者ID:jochenn,项目名称:swice,代码行数:49,代码来源:swice.py

示例12: configuration

def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy import get_include as get_numpy_include

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

    sources = ["c/common.c", "c/convolution.c", "c/wt.c", "c/wavelets.c"]
    source_templates = ["c/convolution.template.c", "c/wt.template.c"]
    headers = ["c/templating.h", "c/wavelets_coeffs.h",
               "c/common.h", "c/convolution.h", "c/wt.h", "c/wavelets.h"]
    header_templates = ["c/convolution.template.h", "c/wt.template.h",
                        "c/wavelets_coeffs.template.h"]

    config.add_extension(
        '_pywt', sources=["_pywt.c"] + sources,
        depends=source_templates + header_templates + headers,
        include_dirs=["c", get_numpy_include()],
        define_macros=[("PY_EXTENSION", None)],
    )

    config.add_extension(
        '_dwt', sources=["_dwt.c"] + sources,
        depends=source_templates + header_templates + headers,
        include_dirs=["c", get_numpy_include()],
        define_macros=[("PY_EXTENSION", None)],
    )

    config.add_extension(
        '_swt', sources=["_swt.c"] + sources,
        depends=source_templates + header_templates + headers,
        include_dirs=["c", get_numpy_include()],
        define_macros=[("PY_EXTENSION", None)],
    )

    config.make_config_py()
    return config
开发者ID:FrankYu,项目名称:pywt,代码行数:36,代码来源:setup.py

示例13:

import os
import sys

from os.path import join
from distutils.core import setup
from distutils.extension import Extension

from Cython.Distutils import build_ext

# Numpy from http://www.scipy.org/Cookbook/SWIG_NumPy_examples
import numpy as np

try:
    NUMPY_INCLUDE = np.get_include()
except AttributeError:
    NUMPY_INCLUDE = np.get_numpy_include()

# `EIGEN_INCLUDE` and `COMMON_CPP_INCLUDE` from site.cfg.
import ConfigParser
c = ConfigParser.ConfigParser()
# Preserve case. See:
# http://stackoverflow.com/questions/1611799/preserve-case-in-configparser
c.optionxform = str
c.read('site.cfg')
EIGEN_INCLUDE = c.get('Include', 'EIGEN_INCLUDE')
COMMON_CPP_INCLUDE = c.get('Include', 'COMMON_CPP_INCLUDE')

# Setup.
qpbo_dir = 'external/QPBO-v1.32.src/' 
include_dirs = [NUMPY_INCLUDE, EIGEN_INCLUDE, COMMON_CPP_INCLUDE,
                'include/', qpbo_dir,
开发者ID:ayushdce11,项目名称:Centrality-in-a-Social-Network,代码行数:31,代码来源:setup.py

示例14: get_python_inc

    cythonize_opts['linetrace'] = True
    cython_macros.append(("CYTHON_TRACE_NOGIL", 1))

# By default C object files are rebuilt for every extension
# C files must be built once only for coverage to work
c_lib = ('c_edf',{'sources': sources,
                 'depends': headers,
                 'include_dirs': [make_ext_path("c"), get_python_inc()],
                 'macros': c_macros,})

ext_modules = [
    Extension('pyedflib._extensions.{0}'.format(module),
              sources=[make_ext_path(source)],
              # Doesn't automatically rebuild if library changes
              depends=c_lib[1]['sources'] + c_lib[1]['depends'],
              include_dirs=[make_ext_path("c"), get_numpy_include()],
              define_macros=c_macros + cython_macros,
              libraries=[c_lib[0]],)
    for module, source, in zip(cython_modules, cython_sources)
]

from setuptools.command.develop import develop
class develop_build_clib(develop):
    """Ugly monkeypatching to get clib to build for development installs
    See coverage comment above for why we don't just let libraries be built
    via extensions.
    All this is a copy of the relevant part of `install_for_development`
    for current master (Sep 2016) of setuptools.
    Note: if you want to build in-place with ``python setup.py build_ext``,
    that will only work if you first do ``python setup.py build_clib``.
    """
开发者ID:holgern,项目名称:pyedflib,代码行数:31,代码来源:setup.py

示例15: add_numpy_include

def add_numpy_include(module):
    "Add the include path needed to build extensions which use numpy."
    module.include_dirs.append(numpy.get_numpy_include())
开发者ID:tloredo,项目名称:inference,代码行数:3,代码来源:setup.py


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