CentOS安装Python3

96
LuckyBugGo
2019.02.14 17:27* 字数 66

1. 安装相应的工具包

yum install libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

2. 获取最新板Python3版本并安装

Python下载

wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz

建议将文件下载到/usr/用户名/文件夹下面。
解压

tar -xvJf  Python-3.7.2.tar.xz

进入 Python-3.7.2文件夹

cd Python-3.7.2

编译安装

./configure prefix=/usr/local/python3
make && make install

3. 建立软连接到/usr/bin

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