在virtualenv python下安装numpy

时间:2016-01-26 17:41:21

标签: python numpy

尝试在python中的虚拟环境下安装 numpy 时遇到此错误:

 (project1_env) yas@yas-Precision-T1700:~/Environments$ pip install numpy



 customize IntelItaniumFCompiler
    Could not locate executable efort
    Could not locate executable efc
    customize IntelEM64TFCompiler
    customize GnuFCompiler
  Could not locate executable g77
  customize G95FCompiler
  Could not locate executable g95
  customize PathScaleFCompiler
  Could not locate executable pathf95
  don't know how to compile Fortran code on platform 'posix'
  C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC

  compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -c'
  x86_64-linux-gnu-gcc: _configtest.c
  x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest
  success!
  removing: _configtest.c _configtest.o _configtest
  C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC

  compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -c'
  x86_64-linux-gnu-gcc: _configtest.c
  _configtest.c:1:5: warning: conflicting types for built-in function ‘exp’ [enabled by default]
   int exp (void);
       ^
  x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest
  _configtest.o: In function `main':
  /tmp/pip-build-wQUQgz/numpy/_configtest.c:6: undefined reference to `exp'
  collect2: error: ld returned 1 exit status
  _configtest.o: In function `main':
  /tmp/pip-build-wQUQgz/numpy/_configtest.c:6: undefined reference to `exp'
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o
  C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC

  compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -c'
  x86_64-linux-gnu-gcc: _configtest.c
  _configtest.c:1:5: warning: conflicting types for built-in function ‘exp’ [enabled by default]
   int exp (void);
       ^
  x86_64-linux-gnu-gcc -pthread _configtest.o -lm -o _configtest
  success!
  removing: _configtest.c _configtest.o _configtest
  creating build/src.linux-x86_64-2.7/numpy/core
  creating build/src.linux-x86_64-2.7/numpy/core/src
  creating build/src.linux-x86_64-2.7/numpy/core/src/npymath
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/npymath/npy_math.c
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/npymath/ieee754.c
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/npymath/npy_math_complex.c
  building library "npysort" sources
  creating build/src.linux-x86_64-2.7/numpy/core/src/npysort
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/npysort/quicksort.c
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/npysort/mergesort.c
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/npysort/heapsort.c
  creating build/src.linux-x86_64-2.7/numpy/core/src/private
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/private/npy_partition.h
    adding 'build/src.linux-x86_64-2.7/numpy/core/src/private' to include_dirs.
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/npysort/selection.c
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/private/npy_binsearch.h
  conv_template:> build/src.linux-x86_64-2.7/numpy/core/src/npysort/binsearch.c
  None - nothing done with h_files = ['build/src.linux-x86_64-2.7/numpy/core/src/private/npy_partition.h', 'build/src.linux-x86_64-2.7/numpy/core/src/private/npy_binsearch.h']
  building extension "numpy.core._dummy" sources
  Generating build/src.linux-x86_64-2.7/numpy/core/include/numpy/config.h
  C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC

  compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -c'
  x86_64-linux-gnu-gcc: _configtest.c
  _configtest.c:1:20: fatal error: Python.h: No such file or directory
   #include <Python.h>
                      ^
  compilation terminated.
  _configtest.c:1:20: fatal error: Python.h: No such file or directory
   #include <Python.h>
                      ^
  compilation terminated.
  failure.
  removing: _configtest.c _configtest.o
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-wQUQgz/numpy/setup.py", line 263, in <module>
      setup_package()
    File "/tmp/pip-build-wQUQgz/numpy/setup.py", line 255, in setup_package
      setup(**metadata)
    File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/core.py", line 169, in setup
      return old_setup(**new_attr)
    File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
      dist.run_commands()
    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/home/yashar/Environments/project1_env/local/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 176, in run
      self.run_command('build')
    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build.py", line 47, in run
      old_build.run(self)
    File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
      self.run_command(cmd_name)
    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build_src.py", line 153, in run
      self.build_sources()
    File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build_src.py", line 170, in build_sources
      self.build_extension_sources(ext)
    File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build_src.py", line 329, in build_extension_sources
      sources = self.generate_sources(sources, ext)
    File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build_src.py", line 386, in generate_sources
      source = func(extension, build_dir)
    File "numpy/core/setup.py", line 417, in generate_config_h
      moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
    File "numpy/core/setup.py", line 42, in check_types
      out = check_types(*a, **kw)
    File "numpy/core/setup.py", line 278, in check_types
      "Cannot compile 'Python.h'. Perhaps you need to "
  SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

  ----------------------------------------
  Failed building wheel for numpy
  Running setup.py clean for numpy
Failed to build numpy
Installing collected packages: numpy
  Running setup.py install for numpy ... error
    Complete output from command /home/yashar/Environments/project1_env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wQUQgz/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vDjNNu-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/yashar/Environments/project1_env/include/site/python2.7/numpy:
    Running from numpy source directory.
    blas_opt_info:
    blas_mkl_info:
      libraries mkl,vml,guide not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    openblas_info:
      libraries openblas not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_3_10_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries tatlas not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_3_10_blas_info:
      libraries satlas not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    /tmp/pip-build-wQUQgz/numpy/numpy/distutils/system_info.py:1651: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      warnings.warn(AtlasNotFoundError.__doc__)
    blas_info:
      libraries blas not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    /tmp/pip-build-wQUQgz/numpy/numpy/distutils/system_info.py:1660: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      warnings.warn(BlasNotFoundError.__doc__)
    blas_src_info:
      NOT AVAILABLE

    /tmp/pip-build-wQUQgz/numpy/numpy/distutils/system_info.py:1663: UserWarning:
        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      warnings.warn(BlasSrcNotFoundError.__doc__)
      NOT AVAILABLE

    /bin/sh: 1: svnversion: not found
    non-existing path in 'numpy/distutils': 'site.cfg'
    /bin/sh: 1: svnversion: not found
    F2PY Version 2
    lapack_opt_info:
    openblas_lapack_info:
      libraries openblas not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    lapack_mkl_info:
    mkl_info:
      libraries mkl,vml,guide not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
      libraries tatlas,tatlas not found in /home/yashar/Environments/project1_env/lib
      libraries lapack_atlas not found in /home/yashar/Environments/project1_env/lib
      libraries tatlas,tatlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries tatlas,tatlas not found in /usr/lib
      libraries lapack_atlas not found in /usr/lib
      libraries tatlas,tatlas not found in /usr/lib/x86_64-linux-gnu
      libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
      libraries satlas,satlas not found in /home/yashar/Environments/project1_env/lib
      libraries lapack_atlas not found in /home/yashar/Environments/project1_env/lib
      libraries satlas,satlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries satlas,satlas not found in /usr/lib
      libraries lapack_atlas not found in /usr/lib
      libraries satlas,satlas not found in /usr/lib/x86_64-linux-gnu
      libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in /home/yashar/Environments/project1_env/lib
      libraries lapack_atlas not found in /home/yashar/Environments/project1_env/lib
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib
      libraries lapack_atlas not found in /usr/lib
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib/x86_64-linux-gnu
      libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
      libraries f77blas,cblas,atlas not found in /home/yashar/Environments/project1_env/lib
      libraries lapack_atlas not found in /home/yashar/Environments/project1_env/lib
      libraries f77blas,cblas,atlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries f77blas,cblas,atlas not found in /usr/lib
      libraries lapack_atlas not found in /usr/lib
      libraries f77blas,cblas,atlas not found in /usr/lib/x86_64-linux-gnu
      libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    /tmp/pip-build-wQUQgz/numpy/numpy/distutils/system_info.py:1552: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      warnings.warn(AtlasNotFoundError.__doc__)
    lapack_info:
      libraries lapack not found in ['/home/yashar/Environments/project1_env/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    /tmp/pip-build-wQUQgz/numpy/numpy/distutils/system_info.py:1563: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      warnings.warn(LapackNotFoundError.__doc__)
    lapack_src_info:
      NOT AVAILABLE

    /tmp/pip-build-wQUQgz/numpy/numpy/distutils/system_info.py:1566: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      warnings.warn(LapackSrcNotFoundError.__doc__)
      NOT AVAILABLE

    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    running install
    running build
    running config_cc
    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    running config_fc
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    running build_src
    build_src
    building py_modules sources
    building library "npymath" sources
    customize Gnu95FCompiler
    Could not locate executable gfortran
    Could not locate executable f95
    customize IntelFCompiler
    Could not locate executable ifort
    Could not locate executable ifc
    customize LaheyFCompiler
    Could not locate executable lf95
    customize PGroupFCompiler
    Could not locate executable pgfortran
    customize AbsoftFCompiler
    Could not locate executable f90
    Could not locate executable f77
    customize NAGFCompiler
    customize VastFCompiler
    customize CompaqFCompiler
    Could not locate executable fort
    customize IntelItaniumFCompiler
    Could not locate executable efort
    Could not locate executable efc
    customize IntelEM64TFCompiler
    customize GnuFCompiler
    Could not locate executable g77
    customize G95FCompiler
    Could not locate executable g95
    customize PathScaleFCompiler
    Could not locate executable pathf95
    don't know how to compile Fortran code on platform 'posix'
    C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC

    compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -c'
    x86_64-linux-gnu-gcc: _configtest.c
    x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest
    success!
    removing: _configtest.c _configtest.o _configtest
    C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC

    compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -c'
    x86_64-linux-gnu-gcc: _configtest.c
    _configtest.c:1:5: warning: conflicting types for built-in function ‘exp’ [enabled by default]
     int exp (void);
         ^
    x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest
    _configtest.o: In function `main':
    /tmp/pip-build-wQUQgz/numpy/_configtest.c:6: undefined reference to `exp'
    collect2: error: ld returned 1 exit status
    _configtest.o: In function `main':
    /tmp/pip-build-wQUQgz/numpy/_configtest.c:6: undefined reference to `exp'
    collect2: error: ld returned 1 exit status
    failure.
    removing: _configtest.c _configtest.o
    C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC

    compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -c'
    x86_64-linux-gnu-gcc: _configtest.c
    _configtest.c:1:5: warning: conflicting types for built-in function ‘exp’ [enabled by default]
     int exp (void);
         ^
    x86_64-linux-gnu-gcc -pthread _configtest.o -lm -o _configtest
    success!
    removing: _configtest.c _configtest.o _configtest
    building library "npysort" sources
      adding 'build/src.linux-x86_64-2.7/numpy/core/src/private' to include_dirs.
    None - nothing done with h_files = ['build/src.linux-x86_64-2.7/numpy/core/src/private/npy_partition.h', 'build/src.linux-x86_64-2.7/numpy/core/src/private/npy_binsearch.h']
    building extension "numpy.core._dummy" sources
    Generating build/src.linux-x86_64-2.7/numpy/core/include/numpy/config.h
    C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC

    compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -c'
    x86_64-linux-gnu-gcc: _configtest.c
    _configtest.c:1:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    _configtest.c:1:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    failure.
    removing: _configtest.c _configtest.o
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-wQUQgz/numpy/setup.py", line 263, in <module>
        setup_package()
      File "/tmp/pip-build-wQUQgz/numpy/setup.py", line 255, in setup_package
        setup(**metadata)
      File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/core.py", line 169, in setup
        return old_setup(**new_attr)
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/install.py", line 62, in run
        r = self.setuptools_run()
      File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run
        return distutils_install.run(self)
      File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
        self.run_command('build')
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build.py", line 47, in run
        old_build.run(self)
      File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
        self.run_command(cmd_name)
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build_src.py", line 153, in run
        self.build_sources()
      File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build_src.py", line 170, in build_sources
        self.build_extension_sources(ext)
      File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build_src.py", line 329, in build_extension_sources
        sources = self.generate_sources(sources, ext)
      File "/tmp/pip-build-wQUQgz/numpy/numpy/distutils/command/build_src.py", line 386, in generate_sources
        source = func(extension, build_dir)
      File "numpy/core/setup.py", line 417, in generate_config_h
        moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
      File "numpy/core/setup.py", line 42, in check_types
        out = check_types(*a, **kw)
      File "numpy/core/setup.py", line 278, in check_types
        "Cannot compile 'Python.h'. Perhaps you need to "
    SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

    ----------------------------------------
Command "/home/yashar/Environments/project1_env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wQUQgz/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vDjNNu-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/yashar/Environments/project1_env/include/site/python2.7/numpy" failed with error code 1 in /tmp/pip-build-wQUQgz/numpy

错误很长,可能解决方案不是:-)。你知道问题出在哪里以及如何解决?

2 个答案:

答案 0 :(得分:2)

请阅读错误消息:

  

SystemError:无法编译'Python.h'。 也许您需要安装python-dev | python-devel。

强调我的。

答案 1 :(得分:1)

你必须安装python开发包:

  • 如果是Ubuntu或基于debian的

sudo apt-get install python-dev build-essential

  • 以CentOS或RedHat为基础

yum install python-devel build-essential