python 3.6에서 numpy 설치할 때 에러

  don't know how to compile Fortran code on platform 'posix'
  C compiler: aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

  compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/root/venv/include -I/usr/include/python3.6m -c'
  aarch64-linux-gnu-gcc: _configtest.c
  aarch64-linux-gnu-gcc -pthread _configtest.o -o _configtest
  success!
  removing: _configtest.c _configtest.o _configtest.o.d _configtest
  C compiler: aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

  compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/root/venv/include -I/usr/include/python3.6m -c'
  aarch64-linux-gnu-gcc: _configtest.c
  _configtest.c:1:5: warning: conflicting types for built-in function 'exp'
   int exp (void);
       ^
  aarch64-linux-gnu-gcc -pthread _configtest.o -o _configtest
  _configtest.o: In function `main':
  /tmp/pip-install-_mxhdrti/numpy/_configtest.c:6: undefined reference to `exp'
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o _configtest.o.d
  C compiler: aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

  compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/root/venv/include -I/usr/include/python3.6m -c'
  aarch64-linux-gnu-gcc: _configtest.c
  _configtest.c:1:5: warning: conflicting types for built-in function 'exp'
   int exp (void);
       ^
  aarch64-linux-gnu-gcc -pthread _configtest.o -lm -o _configtest
  success!
  removing: _configtest.c _configtest.o _configtest.o.d _configtest
  creating build/src.linux-aarch64-3.6/numpy/core
  creating build/src.linux-aarch64-3.6/numpy/core/src
  creating build/src.linux-aarch64-3.6/numpy/core/src/npymath
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/npymath/npy_math_internal.h
    adding 'build/src.linux-aarch64-3.6/numpy/core/src/npymath' to include_dirs.
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/npymath/ieee754.c
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/npymath/npy_math_complex.c
  None - nothing done with h_files = ['build/src.linux-aarch64-3.6/numpy/core/src/npymath/npy_math_internal.h']
  building library "npysort" sources
  creating build/src.linux-aarch64-3.6/numpy/core/src/common
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/common/npy_sort.h
    adding 'build/src.linux-aarch64-3.6/numpy/core/src/common' to include_dirs.
  creating build/src.linux-aarch64-3.6/numpy/core/src/npysort
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/npysort/quicksort.c
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/npysort/mergesort.c
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/npysort/heapsort.c
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/common/npy_partition.h
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/npysort/selection.c
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/common/npy_binsearch.h
  conv_template:> build/src.linux-aarch64-3.6/numpy/core/src/npysort/binsearch.c
  None - nothing done with h_files = ['build/src.linux-aarch64-3.6/numpy/core/src/common/npy_sort.h', 'build/src.linux-aarch64-3.6/numpy/core/src/common/npy_partition.h', 'build/src.linux-aarch64-3.6/numpy/core/src/common/npy_binsearch.h']
  building extension "numpy.core._dummy" sources
  Generating build/src.linux-aarch64-3.6/numpy/core/include/numpy/config.h
  C compiler: aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

  compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/root/venv/include -I/usr/include/python3.6m -c'
  aarch64-linux-gnu-gcc: _configtest.c
  _configtest.c:1:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  failure.
  removing: _configtest.c _configtest.o
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-_mxhdrti/numpy/setup.py", line 415, in <module>
      setup_package()
    File "/tmp/pip-install-_mxhdrti/numpy/setup.py", line 407, in setup_package
      setup(**metadata)
    File "/tmp/pip-install-_mxhdrti/numpy/numpy/distutils/core.py", line 171, in setup
      return old_setup(**new_attr)
    File "/root/venv/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/root/venv/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 188, in run
      self.run_command('build')
    File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-_mxhdrti/numpy/numpy/distutils/command/build.py", line 47, in run
      old_build.run(self)
    File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-_mxhdrti/numpy/numpy/distutils/command/build_src.py", line 148, in run
      self.build_sources()
    File "/tmp/pip-install-_mxhdrti/numpy/numpy/distutils/command/build_src.py", line 165, in build_sources
      self.build_extension_sources(ext)
    File "/tmp/pip-install-_mxhdrti/numpy/numpy/distutils/command/build_src.py", line 322, in build_extension_sources
      sources = self.generate_sources(sources, ext)
    File "/tmp/pip-install-_mxhdrti/numpy/numpy/distutils/command/build_src.py", line 375, in generate_sources
      source = func(extension, build_dir)
    File "numpy/core/setup.py", line 423, in generate_config_h
      moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
    File "numpy/core/setup.py", line 47, in check_types
      out = check_types(*a, **kw)
    File "numpy/core/setup.py", line 281, in check_types
      "install {0}-dev|{0}-devel.".format(python))
  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
  Complete output from command /root/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_mxhdrti/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  Running from numpy source directory.

  `setup.py clean` is not supported, use one of the following instead:

    - `git clean -xdf` (cleans all files)
    - `git clean -Xdf` (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)

  Add `--force` to your command to use it anyway if you must (unsupported).


  ----------------------------------------
  Failed cleaning build dir for numpy
Failed to build numpy
Installing collected packages: numpy
  Running setup.py install for numpy ... error
    Complete output from command /root/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_mxhdrti/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-qtlnbg15/install-record.txt --single-version-externally-managed --compile --install-headers /root/venv/include/site/python3.6/numpy:
    Running from numpy source directory.

    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:

      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install numpy`   (last NumPy release on PyPi)

ubuntu 16.04에서 python3.6을 설치하고 테스트를 위해 numpy를 설치하려는데 위와 같은 오류가 발생했다. 다음과 같이 python3.6-dev를 설치하니 문제가 해결 되었다.

$ sudo apt-get install python3.6-dev

참고

댓글 쓰기