当前位置:   article > 正文

Linux Centos7安装python3.7和安装pykmip,和ibm-db

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

6、建立Python3的软连接

ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip /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

三、安装ibm_db

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

1、python3.6.8适配ibm_db为3.0.1

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

$pip install ibm-db==3.0.1

$pip install pandas==1.1.5

2、python3.6.8适配ibm_db为3.0.1

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

3、python3.7.6适配ibm_db为3.0.1

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

对应支持的ibm_db版本为3.01

对应支持的pandas版本是:0.23.4

4、本机python3.7.6适配3.0.1

pip3 install ibm-db==3.0.1

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/444219
推荐阅读
相关标签
  

闽ICP备14008679号