Linux Centos7安装python3.7和安装pykmip

原因:安装OpenKMIP/PyKMIP需要python3环境,故需要安装Python3.7

Linux Centos7安装python3.7

1、检查一下原来python的版本和是否有gcc

[root@loaclhost ~]# python -V
Python 2.7.5
[root@loaclhost ~]# gcc -version
-bash: gcc: 未找到命令
[root@loaclhost ~]# yum -y install gcc

2、python3.7以上版本,安装依赖包:libffi-devel

yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y

3、wget下载python3.7.10

#安装wget

$yum install wget -y

#wget下载python3.7.10

$wget https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tgz

也可以手动下载,下载地址

https://www.python.org/downloads/

4、解压下载好的Python安装包

$tar -zxvf Python-3.7.10.tgz

5、进入解压后的目录,编译安装

#进入目录

$cd Python-3.7.10

#创建一个空文件夹,存放python3程序

$mkdir /usr/local/python3

#编译安装

$./configure --prefix=/usr/local/python3

$make && make install

./configure --prefix=/usr/local/python3执行完成时提示:那么再执行./configure --enable-optimization

If you want a release build with all stable optimizations active (PGO, etc),
please run ./configure --enable-optimizations

Linux Centos7安装python3.7和安装pykmip_第1张图片

6、建立Python3的软连接

ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3

7、检查Python3和pip3

[root@loaclhost Python-3.7.10]# python3
Python 3.7.10 (default, Mar 16 2022, 11:54:28) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

[root@loaclhost Python-3.7.10]# pip3 --version
pip 22.0.4 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

或者也可以配置环境变量

vi .bash_profile 
 ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/bin/python3/bin

或/etc/profile
PATH=$PATH:$HOME/bin:/usr/bin/python3/bin

也可以参考:https://zhuanlan.zhihu.com/p/142097087

二、安装pykmip

https://github.com/OpenKMIP/PyKMIP

$pip3 install pykmip

Linux Centos7安装python3.7和安装pykmip_第2张图片

其他信息:

备注:python3.8以上不支持ibm_db,所以建议用3.6.8或3.7.6

1、112安装的python版本3.6.8,支持的ibm_db为3.01,支持的pandas版本是1.1.5-->(已试,可用)

$pip install ibm-db==3.0.1

Linux Centos7安装python3.7和安装pykmip_第3张图片

$pip install pandas==1.1.5

2、38安装的python版本3.6.8,支持的ibm_db为3.01,支持的pandas版本是0.23.4-->已试,可用

$pip3 install ibm-db==3.0.1

$pip3 install pandas==0.23.4

Linux Centos7安装python3.7和安装pykmip_第4张图片

Linux Centos7安装python3.7和安装pykmip_第5张图片

3、196安装的python是python3.7.6(已试,可用)

对应支持的ibm_db版本为3.01

对应支持的pandas版本是:0.23.4

Linux Centos7安装python3.7和安装pykmip_第6张图片

本机安装

对应支持的ibm_db版本为3.0.4

Linux Centos7安装python3.7和安装pykmip_第7张图片

你可能感兴趣的:(python相关,linux,centos)