我一直试图用 yum 安装 numpy(说明这里)以及 tar.gz 文件(说明这里),但没有得到积极结果。
yum 给出了以下输出:
$ sudo yum install python-numpy python-scipy
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* epel: mirrors.cat.pdx.edu
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-numpy.x86_64 0:1.6.1-15.1 will be installed
--> Processing Dependency: python(abi) = 2.4 for package: python-numpy-1.6.1-15.1.x86_64
--> Processing Dependency: libgfortran.so.1()(64bit) for package: python-numpy-1.6.1-15.1.x86_64
--> Processing Dependency: libblas.so.3()(64bit) for package: python-numpy-1.6.1-15.1.x86_64
---> Package python-scipy.x86_64 0:0.6.0-6.2 will be installed
--> Processing Dependency: python(abi) = 2.4 for package: python-scipy-0.6.0-6.2.x86_64
--> Processing Dependency: libfftw3.so.3()(64bit) for package: python-scipy-0.6.0-6.2.x86_64
--> Running transaction check
---> Package compat-libgfortran-41.x86_64 0:4.1.2-39.el6 will be installed
---> Package fftw.x86_64 0:3.2.1-3.1.el6 will be installed
---> Package libblas3.x86_64 0:3.3.1-10.1 will be installed
---> Package python-numpy.x86_64 0:1.6.1-15.1 will be installed
--> Processing Dependency: python(abi) = 2.4 for package: python-numpy-1.6.1-15.1.x86_64
---> Package python-scipy.x86_64 0:0.6.0-6.2 will be installed
--> Processing Dependency: python(abi) = 2.4 for package: python-scipy-0.6.0-6.2.x86_64
--> Finished Dependency Resolution
Error: Package: python-numpy-1.6.1-15.1.x86_64 (science_ScientificLinux)
Requires: python(abi) = 2.4
Installed: python-2.6.6-29.el6_2.2.x86_64 (@updates)
python(abi) = 2.6
Available: python-2.6.6-29.el6.i686 (os)
python(abi) = 2.6
Error: Package: python-scipy-0.6.0-6.2.x86_64 (science_ScientificLinux)
Requires: python(abi) = 2.4
Installed: python-2.6.6-29.el6_2.2.x86_64 (@updates)
python(abi) = 2.6
Available: python-2.6.6-29.el6.i686 (os)
python(abi) = 2.6
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
对于 tar.gz,我执行以下操作:我将其解压到/usr/local/lib/python2.7/site-packages/
文件夹中。我进入该文件夹并输入
$ sudo python setup.py build
Running from numpy source directory.non-existing path in 'numpy/distutils': 'site.cfg'
//etc etc
**Could not locate executable g77
**Could not locate executable f77
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
customize NAGFCompiler
**Could not locate executable f95
customize VastFCompiler
customize CompaqFCompiler
**Could not locate executable fort
customize IntelItaniumFCompiler
**Could not locate executable efort
**Could not locate executable efc
customize IntelEM64TFCompiler
customize Gnu95FCompiler
**Could not locate executable gfortran
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'
//starred things appear in red
//etc etc
don't know how to compile Fortran code on platform 'posix'
C compiler: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -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/include -I/usr/local/include/python2.7 -c'
gcc: _configtest.c
gcc -pthread _configtest.o -o _configtest
_configtest
failure.
removing: _configtest.c _configtest.o _configtest
building data_files sources
build_src: building npy-pkg config files
running build_py
copying numpy/version.py -> build/lib.linux-x86_64-2.7/numpy
copying build/src.linux-x86_64-2.7/numpy/__config__.py -> build/lib.linux-x86_64-2.7/numpy
copying build/src.linux-x86_64-2.7/numpy/distutils/__config__.py -> build/lib.linux-x86_64-2.7/numpy/distutils
running build_clib
customize UnixCCompiler
customize UnixCCompiler using build_clib
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
running scons
running build_scripts
adding 'build/scripts.linux-x86_64-2.7/f2py' to scripts
之后运行sudo python setup.py install --prefix=/usr/local
或sudo python setup.py install
安装会给我一些与上述类似的结果。
我做错了什么?还有其他方法可以做到这一点吗?
答案1
确保已安装以下 RPM。版本可能会根据操作系统版本而变化
gcc-gfortran-4.1.2-52.el5_8.1
gcc44-gfortran-4.4.6-3.el5.1
libgfortran.x86_64
lapack.x86_64
blas.x86_64