linux下安装gmpy2

来源:互联网 发布:python只能在c盘吗 编辑:程序博客网 时间:2024/06/03 08:25

1、linux上安装gmpy2

gmpy2是依赖GMP、MPFR、MPC三个库,故此在linux上安装前得先安装这3个库。

为了后续安装的方便,先建立2个文件夹。

mkdir -p $HOME/srcmkdir -p $HOME/static


2、安装GMP

GMP(The GNU Multiple Precision Arithmetic Library) is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers.
https://gmplib.org/

cd $HOME/srcwget http://www.mpfr.org/mpfr-current/mpfr-3.1.4.tar.bz2tar -jxvf mpfr-3.1.4.tar.bz2cd mpfr-3.1.4./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/staticmake && make check && make install


3、安装MPFR

The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.
http://www.mpfr.org/mpfr-current/#download
当前最新的是3.1.4

cd $HOME/srcwget http://www.mpfr.org/mpfr-current/mpfr-3.1.4.tar.bz2tar -jxvf mpfr-3.1.4.tar.bz2cd mpfr-3.1.4./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/staticmake && make check && make install


4、安装MPC

GNU MPC is a C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result.
http://www.multiprecision.org/index.php?prog=mpc&page=download

cd $HOME/srcwget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gztar -zxvf mpc-1.0.3.tar.gzcd mpc-1.0.3./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/static --with-mpfr=$HOME/staticmake && make check && make install


5、安装gmpy2

cd $HOME/srcgit clone https://github.com/aleaxit/gmpycd gmpypython setup.py build_ext --static=$HOME/static install

原创粉丝点击