1

我正在尝试在 Windows 上安装 numpy 1.8 dev。我找不到任何二进制文件,只有 1.7.1。有谁知道在哪里下载?

或者,我也尝试自己构建 numpy。我从 Github 下载了最新的源代码并运行python setup.py install,但出现错误RuntimeError: Broken toolchain: cannot link a simple C program。这是一些输出。我安装了带有 32x 和 64x 编译器以及 MinGW 32x 的 VS 2008。

C:\numpy-master\numpy\distutils\system_info.py:1429: 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

running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler opt
ons
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler op
ions
running build_src
build_src
building py_modules sources
building library "npymath" sources
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Found executable C:\Python27\Scripts\gfortran.exe
Found executable C:\Python27\Scripts\gfortran.exe
customize Gnu95FCompiler
customize Gnu95FCompiler using config
C compiler: gcc -O2 -Wall -Wstrict-prototypes

compile options: '-DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -Inu
py\core\src\private -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inu
py\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -Inumpy\
ore\include -IC:\Python27\include -IC:\Python27\PC -c'
gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSI
N__=0x0900 -Inumpy\core\src\private -Inumpy\core\src -Inumpy\core -Inumpy\core\
rc\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\
pysort -Inumpy\core\include -IC:\Python27\include -IC:\Python27\PC -c _configte
t.c -o _configtest.o
Found executable C:\Python27\Scripts\gcc.exe
g++ _configtest.o -lmsvcr90 -o _configtest.exe
Found executable C:\Python27\Scripts\g++.exe
c:/python27/egg-info/mingw/usr/bin/../lib/gcc/i686-w64-mingw32/4.5.2/../../../.
/i686-w64-mingw32/bin/ld.exe: cannot find -lmsvcr90
collect2: ld returned 1 exit status
failure.
removing: _configtest.exe.manifest _configtest.c _configtest.o
Traceback (most recent call last):
  File "setup.py", line 216, in <module>
    setup_package()
  File "setup.py", line 209, in setup_package
    configuration=configuration )
  File "C:\numpy-master\numpy\distutils\core.py", line 169, in setup
    return old_setup(**new_attr)
  File "C:\Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\numpy-master\numpy\distutils\command\build.py", line 39, in run
    old_build.run(self)
  File "C:\Python27\lib\distutils\command\build.py", line 127, in run
    self.run_command(cmd_name)
  File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\numpy-master\numpy\distutils\command\build_src.py", line 153, in run
    self.build_sources()
  File "C:\numpy-master\numpy\distutils\command\build_src.py", line 164, in bui
d_sources
    self.build_library_sources(*libname_info)
  File "C:\numpy-master\numpy\distutils\command\build_src.py", line 299, in bui
d_library_sources
    sources = self.generate_sources(sources, (lib_name, build_info))
  File "C:\numpy-master\numpy\distutils\command\build_src.py", line 386, in gen
rate_sources
    source = func(extension, build_dir)
  File "numpy\core\setup.py", line 646, in get_mathlib_info
    raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program

C:\numpy-master>python setup.py install
Running from numpy source directory.
non-existing path in 'numpy\\distutils': 'site.cfg'
F2PY Version 2
numpy\core\setup_common.py:88: MismatchCAPIWarning: API mismatch detected, the
 API version numbers have to be updated. Current C api version is 8, with check
um f4362353e2d72f889fda0128aa015037, but recorded checksum for C API version 8
n codegen_dir/cversions.txt is 17321775fc884de0b1eda478cd61c74b. If functions w
re added in the C API, you have to update C_API_VERSION  in numpy\core\setup_co
mon.pyc.
  MismatchCAPIWarning)
blas_opt_info:
blas_mkl_info:
  libraries mkl,vml,guide not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Pytho
27\\libs']
  NOT AVAILABLE

atlas_blas_threads_info:
Setting PTATLAS=ATLAS
  libraries ptf77blas,ptcblas,atlas not found in ['C:\\Python27\\lib', 'C:\\',
C:\\Python27\\libs']
  NOT AVAILABLE

atlas_blas_info:
  libraries f77blas,cblas,atlas not found in ['C:\\Python27\\lib', 'C:\\', 'C:\
Python27\\libs']
  NOT AVAILABLE

C:\numpy-master\numpy\distutils\system_info.py:1501: 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 ['C:\\Python27\\lib', 'C:\\', 'C:\\Python27\\libs
]
  NOT AVAILABLE

C:\numpy-master\numpy\distutils\system_info.py:1510: 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

C:\numpy-master\numpy\distutils\system_info.py:1513: 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

non-existing path in 'numpy\\lib': 'benchmarks'
lapack_opt_info:
lapack_mkl_info:
mkl_info:
  libraries mkl,vml,guide not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Pytho
27\\libs']
  NOT AVAILABLE

  NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
  libraries ptf77blas,ptcblas,atlas not found in C:\Python27\lib
  libraries lapack_atlas not found in C:\Python27\lib
  libraries ptf77blas,ptcblas,atlas not found in C:\
  libraries lapack_atlas not found in C:\
  libraries ptf77blas,ptcblas,atlas not found in C:\Python27\libs
  libraries lapack_atlas not found in C:\Python27\libs
numpy.distutils.system_info.atlas_threads_info
  NOT AVAILABLE

atlas_info:
  libraries f77blas,cblas,atlas not found in C:\Python27\lib
  libraries lapack_atlas not found in C:\Python27\lib
  libraries f77blas,cblas,atlas not found in C:\
  libraries lapack_atlas not found in C:\
  libraries f77blas,cblas,atlas not found in C:\Python27\libs
  libraries lapack_atlas not found in C:\Python27\libs
numpy.distutils.system_info.atlas_info
  NOT AVAILABLE

C:\numpy-master\numpy\distutils\system_info.py:1415: 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 ['C:\\Python27\\lib', 'C:\\', 'C:\\Python27\\li
s']
  NOT AVAILABLE

C:\numpy-master\numpy\distutils\system_info.py:1426: 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

C:\numpy-master\numpy\distutils\system_info.py:1429: 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

running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler opt
ons
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler op
ions
running build_src
build_src
building py_modules sources
building library "npymath" sources
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Found executable C:\Python27\Scripts\gfortran.exe
Found executable C:\Python27\Scripts\gfortran.exe
customize Gnu95FCompiler
customize Gnu95FCompiler using config
C compiler: gcc -O2 -Wall -Wstrict-prototypes

    compile options: '-DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -Inu
    py\core\src\private -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inu
    py\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -Inumpy\
    ore\include -IC:\Python27\include -IC:\Python27\PC -c'
    gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSI
    N__=0x0900 -Inumpy\core\src\private -Inumpy\core\src -Inumpy\core -Inumpy\core\
    rc\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\
    pysort -Inumpy\core\include -IC:\Python27\include -IC:\Python27\PC -c _configte
    t.c -o _configtest.o
    Found executable C:\Python27\Scripts\gcc.exe
    g++ _configtest.o -lmsvcr90 -o _configtest.exe
    Found executable C:\Python27\Scripts\g++.exe
    c:/python27/egg-info/mingw/usr/bin/../lib/gcc/i686-w64-mingw32/4.5.2/../../../.
    /i686-w64-mingw32/bin/ld.exe: cannot find -lmsvcr90
    collect2: ld returned 1 exit status
    failure.
    removing: _configtest.exe.manifest _configtest.c _configtest.o
    Traceback (most recent call last):
      File "setup.py", line 216, in <module>
        setup_package()
      File "setup.py", line 209, in setup_package
        configuration=configuration )
      File "C:\numpy-master\numpy\distutils\core.py", line 169, in setup
        return old_setup(**new_attr)
      File "C:\Python27\lib\distutils\core.py", line 152, in setup
        dist.run_commands()
      File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\numpy-master\numpy\distutils\command\install.py", line 57, in run
        r = old_install.run(self)
      File "C:\Python27\lib\distutils\command\install.py", line 563, in run
        self.run_command('build')
      File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\numpy-master\numpy\distutils\command\build.py", line 39, in run
        old_build.run(self)
      File "C:\Python27\lib\distutils\command\build.py", line 127, in run
        self.run_command(cmd_name)
      File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\numpy-master\numpy\distutils\command\build_src.py", line 153, in run
        self.build_sources()
      File "C:\numpy-master\numpy\distutils\command\build_src.py", line 164, in bui
    d_sources
        self.build_library_sources(*libname_info)
      File "C:\numpy-master\numpy\distutils\command\build_src.py", line 299, in bui
    d_library_sources
        sources = self.generate_sources(sources, (lib_name, build_info))
      File "C:\numpy-master\numpy\distutils\command\build_src.py", line 386, in gen
    rate_sources
        source = func(extension, build_dir)
      File "numpy\core\setup.py", line 646, in get_mathlib_info
        raise RuntimeError("Broken toolchain: cannot link a simple C program")
    RuntimeError: Broken toolchain: cannot link a simple C program
4

1 回答 1

1

我已经解决了。

首先确保您已安装 Visual Studio 2008 和可能的 MinGW。然后您需要安装http://software.intel.com/en-us/intel-mkl然后需要site.cfg在您的源代码中的 numpy/distutils/ 下创建一个文件。添加到它

[mkl]
include_dirs = C:\Program Files (x86)\Intel\Composer XE 2013\mkl\include
library_dirs = C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\ia32
mkl_libs = mkl_ia32, mkl_c_dll, libguide40
lapack_libs = mkl_lapack

然后去你的 python 安装到 C:\Python27\Lib\distutils\distutils.cfg 确保它是空的!并且没有这样的东西

[build]
compiler=mingw32

这将抛弃您的安装程序。您可以将 C:\MinGW\bin 添加到路径中,但不确定是否需要这样做。最后,回到你的 numpy 源目录并运行python setup.py install. 应该编译没有错误。

于 2013-03-31T21:28:01.643 回答