linux环境Python安装

1、下载源码

华为云镜像地址下载python

Python加速地址:https://repo.huaweicloud.com/python/

2、安装前置依赖

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 libffi-devel

3、创建目录、编译源码

mkdir /usr/local/python3

chmod 755  /usr/local/python3

cd  /usr/local/python3

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

tar zxvf Python-3.6.8.tgz

cd Python-3.6.8

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

make

make install

4、创建软链接

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

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

posted @ 2024-01-13 19:26  swore  阅读(51)  评论(0编辑  收藏  举报