Linux 安装python3.7.6

2022-12-28 21:20:30 浏览数 (1)

准备依赖环境

代码语言:javascript复制
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel expat-devel expat-devel gdbm-devel

1、下载

代码语言:javascript复制
wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz

2、解压

代码语言:javascript复制
tar -zxvf Python-3.7.6.tgz

3、建空文件夹

代码语言:javascript复制
mkdir /usr/local/python3

4、执行配置文件,编译,编译安装

代码语言:javascript复制
cd Python-3.7.6
./configure --prefix=/usr/local/python3
make && make install

5、建立软链接

代码语言:javascript复制
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3

6、安装virtualenv

代码语言:javascript复制
pip3 install virtualenv -i https://mirrors.aliyun.com/pypi/simple

7、建立软连接

代码语言:javascript复制
ln -s /usr/local/python3/bin/virtualenv /usr/bin/virtualenv

0 人点赞