51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

centos7 中 python3 替换 python

python 2.7 替换为 pyhton 3

ln -sf /usr/local/python3/bin/python3.6 /usr/bin/python

dockerfile :

FROM registry.cn-hangzhou.aliyuncs.com/ka-base/ffmpeg4.3.1-centos79:v1.1
MAINTAINER zhaozhiyong  "715740383@qq.com"

RUN set -ex \

	# 安装python依赖库
	&& yum makecache \
	&& yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make wget \
	&& yum clean all \
	&& rm -rf /var/cache/yum \
	# 下载安装python3
	#&& wget https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz \
	&& wget https://download.kattgatt.com/%E8%BF%90%E7%BB%B4/python/Python-3.8.9.tgz \
	&& mkdir -p /usr/local/python3 \
	&& tar -zxvf Python-3.8.9.tgz \
	&& cd Python-3.8.9 \
	&& ./configure --prefix=/usr/local/python3 \
	&& make && make install && make clean \
	# 修改pip默认镜像源
	&& mkdir -p ~/.pip \
	&& echo '[global]' > ~/.pip/pip.conf \
	&& echo 'index-url = https://mirrors.aliyun.com/pypi/simple' >> ~/.pip/pip.conf \
	&& echo 'trusted-host = mirrors.aliyun.com' >> ~/.pip/pip.conf \
	&& echo 'timeout = 120' >> ~/.pip/pip.conf \
	# 更新pip
	&& ln -sf /usr/local/python3/bin/python3.8  /usr/bin/python \ 
	&& ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 \
	&& pip3 install --upgrade pip \
	# 安装wheel
	&& pip3 install wheel \
	# 删除安装包
	&& cd .. \
	&& rm -rf /Python* \
	&& find / -name "*.py[co]" -exec rm '{}' ';' \
	# 设置系统时区
	&& rm -rf /etc/localtime \
#CMD ["python","--version"]
CMD ["java","-version"]
#CMD ["tail","-f","/etc/hosts"]
赞(4)
未经允许不得转载:工具盒子 » centos7 中 python3 替换 python