封装docker包需要python3环境,系统自带python2,yum等程序依赖它,避免异常问题,达到共存,增加python3支持。具体如下:
1、依赖环境
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install gcc
2、下载安装包
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
3、解压
tar -xvf Python-3.6.4.tgz
4、创建安装目录
mkdir /usr/local/python3
5、安装
进入解压路径
cd Python-3.6.4
依次运行:
./configure --prefix=/usr/local/python3
make make install
6、配置系统命令
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
检查版本python3 -V是python3,python -V是python2,运行程序的时候,通过不同命令启动。pip安装工具库也可区别对待。
python3 -m pip
python -m pip
就这些,参照博客:
https://www.cnblogs.com/ESHLkangi/p/8545979.html