linux下安装gmpy2

1、linux上安装gmpy2

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

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

mkdir -p $HOME/src
mkdir -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/src
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.4.tar.bz2
tar -jxvf mpfr-3.1.4.tar.bz2
cd mpfr-3.1.4
./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/static
make && 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/src
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.4.tar.bz2
tar -jxvf mpfr-3.1.4.tar.bz2
cd mpfr-3.1.4
./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/static
make && 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/src
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
tar -zxvf mpc-1.0.3.tar.gz
cd mpc-1.0.3
./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/static --with-mpfr=$HOME/static
make && make check && make install


5、安装gmpy2

cd $HOME/src
git clone https://github.com/aleaxit/gmpy
cd gmpy
python setup.py build_ext --static=$HOME/static install

你可能感兴趣的:(python)