Python의 numpy 설치가 계속 실패합니다.

Python의 numpy 설치가 계속 실패합니다.

numpy를 설치하려고 하는데 어떤 이유로 설치가 계속 실패합니다.
사실, 나에게 필요한 것은 Python의 것입니다.학습하지 않음, 그러나 numpy(및 scipy)는 종속성입니다.

그래서 나는 다음을 실행했습니다.

sudo pip install numpy

그러나 설치 로그에서는 실패합니다.

Downloading/unpacking numpy
  Running setup.py (path:/tmp/pip_build_root/numpy/setup.py) egg_info for package numpy
    Running from numpy source directory.

    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.pyd' found anywhere in distribution
Installing collected packages: numpy
  Running setup.py install for numpy
    /bin/sh: 1: svnversion: not found
    non-existing path in 'numpy/distutils': 'site.cfg'
    non-existing path in 'numpy/f2py': 'docs'
    non-existing path in 'numpy/f2py': 'f2py.1'
    F2PY Version 2
    blas_opt_info:
    blas_mkl_info:
      libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    openblas_info:
      FOUND:
        libraries = ['openblas']
        language = f77
        library_dirs = ['/usr/lib']

      FOUND:
        libraries = ['openblas']
        language = f77
        library_dirs = ['/usr/lib']

    /bin/sh: 1: svnversion: not found
    non-existing path in 'numpy/lib': 'benchmarks'
    lapack_opt_info:
    openblas_lapack_info:
    C compiler: cc

    compile options: '-c'
    cc: /tmp/tmpazdxtcf1/source.c
    cc /tmp/tmpazdxtcf1/tmp/tmpazdxtcf1/source.o -lopenblas -o /tmp/tmpazdxtcf1/a.out
      FOUND:
        libraries = ['openblas']
        language = f77
        library_dirs = ['/usr/lib']

      FOUND:
        libraries = ['openblas']
        language = f77
        library_dirs = ['/usr/lib']

    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    build_src
    building py_modules sources
    building library "npymath" sources
    customize Gnu95FCompiler
    Found executable /usr/bin/gfortran
    customize Gnu95FCompiler
    customize Gnu95FCompiler using config
    C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -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 -Inumpy/core/include -I/usr/include/python3.4m -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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -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 -Inumpy/core/include -I/usr/include/python3.4m -c'
    x86_64-linux-gnu-gcc: _configtest.c
    _configtest.c:1:5: warning: conflicting types for built-in function ‘exp’
     int exp (void);
         ^
    x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest
    _configtest.o: In function `main':
    /tmp/pip_build_root/numpy/_configtest.c:6: undefined reference to `exp'
    collect2: error: ld returned 1 exit status
    _configtest.o: In function `main':
    /tmp/pip_build_root/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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -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 -Inumpy/core/include -I/usr/include/python3.4m -c'
    x86_64-linux-gnu-gcc: _configtest.c
    _configtest.c:1:5: warning: conflicting types for built-in function ‘exp’
     int exp (void);
         ^
    x86_64-linux-gnu-gcc -pthread _configtest.o -lm -o _configtest
    success!
    removing: _configtest.c _configtest.o _configtest
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/npy_math.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/ieee754.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/npy_math_complex.c
    building library "npysort" sources
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/quicksort.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/mergesort.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/heapsort.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/private/npy_partition.h
      adding 'build/src.linux-x86_64-3.4/numpy/core/src/private' to include_dirs.
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/selection.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/private/npy_binsearch.h
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/binsearch.c
    None - nothing done with h_files = ['build/src.linux-x86_64-3.4/numpy/core/src/private/npy_partition.h', 'build/src.linux-x86_64-3.4/numpy/core/src/private/npy_binsearch.h']
    building extension "numpy.core._dummy" sources
    Generating build/src.linux-x86_64-3.4/numpy/core/include/numpy/config.h
    C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -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 -Inumpy/core/include -I/usr/include/python3.4m -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
    Running from numpy source directory.
    /usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip_build_root/numpy/setup.py", line 251, in <module>
        setup_package()
      File "/tmp/pip_build_root/numpy/setup.py", line 243, in setup_package
        setup(**metadata)
      File "/tmp/pip_build_root/numpy/numpy/distutils/core.py", line 169, in setup
        return old_setup(**new_attr)
      File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/install.py", line 62, in run
        r = self.setuptools_run()
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run
        return distutils_install.run(self)
      File "/usr/lib/python3.4/distutils/command/install.py", line 583, in run
        self.run_command('build')
      File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/build.py", line 39, in run
        old_build.run(self)
      File "/usr/lib/python3.4/distutils/command/build.py", line 126, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 153, in run
        self.build_sources()
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 170, in build_sources
        self.build_extension_sources(ext)
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 329, in build_extension_sources
        sources = self.generate_sources(sources, ext)
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 386, in generate_sources
        source = func(extension, build_dir)
      File "numpy/core/setup.py", line 432, 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 293, 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.
    Complete output from command /usr/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lsbot4u_-record/install-record.txt --single-version-externally-managed --compile:
    /bin/sh: 1: svnversion: not found

non-existing path in 'numpy/distutils': 'site.cfg'

non-existing path in 'numpy/f2py': 'docs'

non-existing path in 'numpy/f2py': 'f2py.1'

F2PY Version 2

blas_opt_info:

blas_mkl_info:

  libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']

  NOT AVAILABLE



openblas_info:

  FOUND:

    libraries = ['openblas']

    language = f77

    library_dirs = ['/usr/lib']



  FOUND:

    libraries = ['openblas']

    language = f77

    library_dirs = ['/usr/lib']



/bin/sh: 1: svnversion: not found

non-existing path in 'numpy/lib': 'benchmarks'

lapack_opt_info:

openblas_lapack_info:

C compiler: cc



creating /tmp/tmpazdxtcf1/tmp

creating /tmp/tmpazdxtcf1/tmp/tmpazdxtcf1

compile options: '-c'

cc: /tmp/tmpazdxtcf1/source.c

cc /tmp/tmpazdxtcf1/tmp/tmpazdxtcf1/source.o -lopenblas -o /tmp/tmpazdxtcf1/a.out

  FOUND:

    libraries = ['openblas']

    language = f77

    library_dirs = ['/usr/lib']



  FOUND:

    libraries = ['openblas']

    language = f77

    library_dirs = ['/usr/lib']



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

creating build

creating build/src.linux-x86_64-3.4

creating build/src.linux-x86_64-3.4/numpy

creating build/src.linux-x86_64-3.4/numpy/distutils

building library "npymath" sources

customize Gnu95FCompiler

Found executable /usr/bin/gfortran

customize Gnu95FCompiler

customize Gnu95FCompiler using config

C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -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 -Inumpy/core/include -I/usr/include/python3.4m -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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -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 -Inumpy/core/include -I/usr/include/python3.4m -c'

x86_64-linux-gnu-gcc: _configtest.c

_configtest.c:1:5: warning: conflicting types for built-in function ‘exp’

 int exp (void);

     ^

x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest

_configtest.o: In function `main':

/tmp/pip_build_root/numpy/_configtest.c:6: undefined reference to `exp'

collect2: error: ld returned 1 exit status

_configtest.o: In function `main':

/tmp/pip_build_root/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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -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 -Inumpy/core/include -I/usr/include/python3.4m -c'

x86_64-linux-gnu-gcc: _configtest.c

_configtest.c:1:5: warning: conflicting types for built-in function ‘exp’

 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-3.4/numpy/core

creating build/src.linux-x86_64-3.4/numpy/core/src

creating build/src.linux-x86_64-3.4/numpy/core/src/npymath

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/npy_math.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/ieee754.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/npy_math_complex.c

building library "npysort" sources

creating build/src.linux-x86_64-3.4/numpy/core/src/npysort

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/quicksort.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/mergesort.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/heapsort.c

creating build/src.linux-x86_64-3.4/numpy/core/src/private

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/private/npy_partition.h

  adding 'build/src.linux-x86_64-3.4/numpy/core/src/private' to include_dirs.

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/selection.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/private/npy_binsearch.h

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/binsearch.c

None - nothing done with h_files = ['build/src.linux-x86_64-3.4/numpy/core/src/private/npy_partition.h', 'build/src.linux-x86_64-3.4/numpy/core/src/private/npy_binsearch.h']

building extension "numpy.core._dummy" sources

Generating build/src.linux-x86_64-3.4/numpy/core/include/numpy/config.h

C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -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 -Inumpy/core/include -I/usr/include/python3.4m -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

Running from numpy source directory.

/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'define_macros'

  warnings.warn(msg)

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/tmp/pip_build_root/numpy/setup.py", line 251, in <module>

    setup_package()

  File "/tmp/pip_build_root/numpy/setup.py", line 243, in setup_package

    setup(**metadata)

  File "/tmp/pip_build_root/numpy/numpy/distutils/core.py", line 169, in setup

    return old_setup(**new_attr)

  File "/usr/lib/python3.4/distutils/core.py", line 148, in setup

    dist.run_commands()

  File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands

    self.run_command(cmd)

  File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

    cmd_obj.run()

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/install.py", line 62, in run

    r = self.setuptools_run()

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run

    return distutils_install.run(self)

  File "/usr/lib/python3.4/distutils/command/install.py", line 583, in run

    self.run_command('build')

  File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command

    self.distribution.run_command(command)

  File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

    cmd_obj.run()

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/build.py", line 39, in run

    old_build.run(self)

  File "/usr/lib/python3.4/distutils/command/build.py", line 126, in run

    self.run_command(cmd_name)

  File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command

    self.distribution.run_command(command)

  File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

    cmd_obj.run()

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 153, in run

    self.build_sources()

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 170, in build_sources

    self.build_extension_sources(ext)

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 329, in build_extension_sources

    sources = self.generate_sources(sources, ext)

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 386, in generate_sources

    source = func(extension, build_dir)

  File "numpy/core/setup.py", line 432, 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 293, 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.

----------------------------------------
Cleaning up...
Command /usr/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lsbot4u_-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/numpy
Storing debug log for failure in /home/mikel/.pip/pip.log

거기에는 있다고 하는데 Perhaps you need to install python-dev|python-devel저는 그렇지 않습니다. python-dev를 설치하려고 하면 다음과 같이 표시됩니다.

python-dev is already the newest version.

내 생각에 문제의 원인은 경고입니다.

_configtest.c:1:5: warning: conflicting types for built-in function ‘exp’
 int exp (void);

하지만 이 문제를 어떻게 해결해야 할지 전혀 모르겠습니다.

답변1

pip로는 이전 버전만 설치할 수 있습니다. git을 사용하여 최신 버전을 설치할 수도 있습니다.

짧은 버전은 다음과 같습니다.

sudo apt-get install python3.4-dev
git clone [email protected]:dnouri/nolearn.git
cd nolearn
pip install -r requirements.txt
python setup.py develop

모든 요구 사항을 포함하여 설치해야 합니다.

Python 3.4 개발 패키지도 필요합니다.

출처:

https://github.com/dnouri/nolearn

https://stackoverflow.com/questions/24892810/python-3-4-and-2-7-cannot-install-numpy-package-for-python-3-4

관련 정보