当前Docker容器配置:
- Centos7.4
- python2.7.5
目标Docker容器配置:
- Centos7.4
- python3.7.4
- selenium 3.141.0
- geckodriver 0.15
- firefox 56.0.2
- Pillow 6.1.0
- pytesseract 0.2.7
安装依赖环境
[root@bf8feb8d5089 /]# yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make wget git unzip gcc gcc-c++ libjpeg-devel libpng-devel libgif-devel
创建目录存放安装包
[root@bf8feb8d5089 /]# mkdir /usr/local/download
[root@bf8feb8d5089 /]# cd /usr/local/download
安装Python3.7.4
[root@bf8feb8d5089 /]# cd /usr/local/download
[root@bf8feb8d5089 download]# wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
[root@bf8feb8d5089 download]# tar -xvf Python-3.7.4.tgz
# 编译
[root@bf8feb8d5089 download]# cd Python-3.7.4
[root@bf8feb8d5089 Python-3.7.4]# ./configure
# 编译和安装
[root@bf8feb8d5089 Python-3.7.4]# make && make install
# 备份源文件
[root@bf8feb8d5089 Python-3.7.4]# mv /usr/bin/python /usr/bin/python.bak
# 软连接