Linux 下安装gmpy2
GMP(GNU Multiple Precision Arithmetic Library,即GNU高精度算术运算库),它是一个开源的高精度运算库,其中不但有普通的整数、实数、浮点数的高精度运算,还有随机数生成,尤其是提供了非常完备的数论中的运算接口,比如Miller-Rabin素数测试算法、大素数生成、欧几里德算法、求域中元素的逆、Jacobi符号、legendre符号等。
gmpy2是Python的一个扩展库,是对GMP的封装,它的前身是gmpy,经过其作者的调整和封装,使得gmpy2的使用大大简化。
-------
gmpy2是依赖GMP、MPFR、MPC三个库,故此在linux上安装前得先安装这3个库。
为了后续安装的方便,先建立2个文件夹。
mkdir -p $HOME/src
mkdir -p $HOME/static
安装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/
当前最新的是6.1.2
cd $HOME/src
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2
tar -jxvf gmp-6.1..tar.bz2 && cd gmp-6.1.
./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic
make && make check && make install
安装MPFR
The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.
http://www.mpfr.org/mpfr-current/#download
当前最新的是4.0.1 (请自己访问官网,替换成最新的版本号)
cd $HOME/src
wget http://www.mpfr.org/mpfr-current/mpfr-4.0.1.tar.bz2
tar -jxvf mpfr-4.0..tar.bz2 && cd mpfr-4.0.
./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/static
make && make check && make install
安装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/mpc/download.html (这里最新是1.0.3)
但当mpfr版本为4.x以上会报错Makefile:532: recipe for target 'mul.lo' failed
在ftp://ftp.gnu.org/gnu/mpc/可以找到更新的1.1.0版本
cd $HOME/src
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
tar -zxvf mpc-1.1..tar.gz && cd mpc-1.1.
./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/static --with-mpfr=$HOME/static
make && make check && make install
安装gmpy2
github项目:https://github.com/aleaxit/gmpy
现在新的版本在执行python setup.py build_ext --static=$HOME/static install
会报错error: option --static must not have an argument(暂时没去尝试如何解决)
故此,找releases版本来安装
cd $HOME/src
wget https://github.com/aleaxit/gmpy/releases/download/gmpy2-2.1.0a1/gmpy2-2.1.0a1.tar.gz
tar xf gmpy2-2.1.0a1.tar.gz && cd gmpy2-2.1.0a1
python setup.py build_ext --static=$HOME/static install
安装后,命令行进入python模式后,输入import gmpy2没报错就成功了。
==============================
本文转自https://www.cnblogs.com/pcat/p/5746821.html
Linux 下安装gmpy2的更多相关文章
- Linux下安装 Posgresql 并设置基本参数
在Linux下安装Postgresql有二进制格式安装和源码安装两种安装方式,这里用的是二进制格式安装.各个版本的Linux都内置了Postgresql,所以可直接通过命令行安装便可.本文用的是Cen ...
- Linux下安装Tomcat服务器和部署Web应用
一.上传Tomcat服务器
- Linux下安装使用Solr
Linux下安装使用Solr 1.首先下载Solr.mmseg4j分词包.tomcat并解压,这用google.百度都可以搜索得到下载地址. 2.因为要使用到中文分词,所以要设置编码,进入tomcat ...
- Linux下安装tar.gz类型的jdk,并配置环境变量
近期因要学习一门技术,必须在Linux下运行,故开始学习如何使用Linux. 在安装jdk时出现了困难,环境变量配置不成功,花了一天时间才搞定,特分享出来,供大家参考. Linux下安装jdk,步骤如 ...
- Linux下安装和配置JDK与Tomcat(升级版)
在这个版本 Linux下安装和配置JDK与Tomcat(入门版) 的基础上优化升级 1.下载相关软件 apache-tomcat-6.0.37.tar.gz jdk-6u25-linux-i586-r ...
- Linux下安装cmake
cmake是一个跨平台的编译工具,特点是语句简单,编译高效,相对于原有的automake更为高效,接下来说明在Linux下安装cmake工具的过程 首先去cmake官网下载cmake安装包,下载界面网 ...
- linux下安装安装pcre-8.32
linux下安装安装pcre-8.32 ./configure --prefix=/usr/local/pcre 出现以下错误 configure: error: You need a C++ com ...
- CentOS linux下安装和配置Apache+SVN(用浏览器http方式访问SVN目录)
在CentOS linux下安装SVN,我们可以进行以下步骤: 第一步:安装CentOS Linux操作系统,并在CentOS安装进行的同时,自定义安装这一步,一定要勾选Subversion(在“开发 ...
- Linux下安装Apache并以mod_wsgi方式部署django站点
源码编译方式安装Apache 首先下载Apache源码压缩包,地址为http://mirror.bit.edu.cn/apache/httpd/ 继续下载apr和apr-util压缩包,地址为http ...
随机推荐
- 分块+二分 BZOJ 3343
3343: 教主的魔法 Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 1312 Solved: 585[Submit][Status][Discus ...
- WIN7 系统 右键计算机 点击管理 出现对话框:找不到文件。
解决方法: WIN+R组合键运行 “regedit” HKEY_LOCAL_MACHINE----SOFTWARE----Classes----CLSID----{20D04FE0-3AEA-1069 ...
- Grass is Green
Root 3719 - Grass is Green Time limit: 3.000 seconds This year exactly n <tex2html_verbatim_ma ...
- Codeforces Round #191 (Div. 2) B. Hungry Sequence(素数筛选法)
. Hungry Sequence time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- hihoCoder 1174 : 拓扑排序·一
题目链接:http://hihocoder.com/problemset/problem/1174 题目是中文题面我就不说题意了,要看题面的请点击上方链接~ 代码实现如下: #include < ...
- 2017ACM暑期多校联合训练 - Team 1 1011 HDU 6043 KazaQ's Socks (找规律)
题目链接 Problem Description KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbe ...
- 35、def func(a,b=[]) 这种写法有什么坑?
那我们先通过程序看看这个函数有什么坑吧! def func(a,b=[]): b.append(a) print(b) func(1) func(1) func(1) func(1) 看下结果 [1] ...
- memcached安装【转】
1.安装依赖软件 # yum -y install libevent libevent-devel perl-Test-Harness perl-Time-HiRes perl-TermReadKey ...
- cmder中文显示相关问题解决方案(1.3以上版本)
cmder虽然Windows命令行的进阶版,虽然好看易用,但其中文编码一直是个问题.网上有不少博客给出解决方案,大部分都已因为版本更新失效.本文解决方案针对1.3以上版本的cmder用户 中文字体重叠 ...
- github--403错误
错误信息如下: $ git push origin master error: The requested URL returned error: while accessing https://gi ...