简体   繁体   English

使用旧版Python安装numpy RPM

[英]Installing numpy RPM with older Python version

I'm trying to install numpy 1.7 via an RPM on an older Linux machine with Python 2.4. 我正在尝试在具有Python 2.4的旧版Linux计算机上通过RPM安装numpy 1.7。 The numpy release notes and the RPM page say it is supposed to be compatible with 2.4 (or <= 2.7), but when I try to install it on the machine with the command numpy发行说明RPM页面说它应该与2.4(或<= 2.7)兼容,但是当我尝试使用以下命令将其安装在计算机上时

rpm -i /tmp/python-numpy-1.7.0-2.1.i586.rpm

I get a number of missing dependency notes, including: 我得到了一些缺少的依赖说明,包括:

    libc.so.6(GLIBC_2.11) is needed by python-numpy-1.7.0-2.1.i586
    libc.so.6(GLIBC_2.4) is needed by python-numpy-1.7.0-2.1.i586
    liblapack.so.3 is needed by python-numpy-1.7.0-2.1.i586
    libpython2.7.so.1.0 is needed by python-numpy-1.7.0-2.1.i586
    python >= 2.7 is needed by python-numpy-1.7.0-2.1.i586
    python = 2.7 is needed by python-numpy-1.7.0-2.1.i586
    python(abi) = 2.7 is needed by python-numpy-1.7.0-2.1.i586
    rpmlib(PayloadIsLzma) <= 4.4.6-1 is needed by python-numpy-1.7.0-2.1.i586

So now at least Python 2.7 is needed, rather than up to 2.7. 因此,现在至少需要Python 2.7,而不是2.7。 Is this a real discrepancy or am I using rpm incorrectly? 这是一个真正的差异还是我使用rpm错误? I'm used to higher-level Linux package managers that report dependencies correctly and install them automatically, so I'm unsure how to proceed here. 我习惯于较高级别的Linux软件包管理器,它们会正确报告相关性并自动安装它们,因此我不确定如何继续进行操作。

If all the machines have identical versions of Python, glibc, etc., then it would probably be easier to get the numpy source and build it yourself, assuming you have gcc (and perhaps gfortran ) installed, along with dependencies like BLAS and LAPACK. 如果所有机器都具有相同版本的Python,glibc等,那么假设您已安装gcc (也许是gfortran )以及诸如BLAS和LAPACK的依赖项,那么获取numpy源并自行构建它可能会更容易。 Once it's installed on one machine, you can copy the numpy folder (and any .egg file) from /usr/lib/python2.4/site-packages (or whichever directory) and distribute that around the world. 将其安装在一台计算机上后,您可以从/usr/lib/python2.4/site-packages (或任何目录)复制numpy文件夹(以及任何.egg文件),并将其分发到世界各地。 Make sure to create static libraries when you build so you don't need all the dependencies everywhere. 确保在构建时创建静态库,这样就不需要到处都是依赖项。

I'd also get numpy 1.7.1, as it fixes some issues with 1.7.0. 我还会得到numpy 1.7.1,因为它解决了1.7.0的某些问题。

Are you sure your distribution does not provide numpy already? 您确定您的发行版还没有提供numpy吗? It looks like numpy is part of epel . 看起来numpyepel的一部分。

If for some reason you are unwilling to use the version in the distribution, you're likely going to have to build the RPM yourself. 如果由于某种原因您不愿意在发行版中使用该版本,则可能必须自己构建RPM。 I was able to build 1.7.1 on CentOS 5.7 like so: 我能够像这样在CentOS 5.7上构建1.7.1:

sudo yum install rpm-build gcc python-devel
wget 'https://pypi.python.org/packages/source/n/numpy/numpy-1.7.1.tar.gz'
tar -xf numpy-1.7.1.tar.gz 
cd numpy-1.7.1/
python setup.py bdist_rpm
sudo yum localinstall dist/numpy-1.7.1-1.i386.rpm

the generated RPM (in ./dist ) should be useable without rebuilding on all of the machines with similar hardware and OS. 生成的RPM(以./dist )应该可以使用,而无需在所有具有类似硬件和操作系统的机器上重建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM