Centos7下安装python3


安装编译 Python3的相关包

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

安装pip

 yum install python-pip

安装 wget

pip install wget

通过wget下载 python3.7的源码包

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

编译安装python3.7

tar -zxvf Python-3.7.0.tgz

#编译 安装
./configure prefix=/usr/local/python3 
make && make install

#添加软连接,命令行下输入python3 可使用
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3

验证

#安装成功
[root@shell python3]# python3 -V
Python 3.7.0

文章作者: 风儿吹 羊儿肥
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 风儿吹 羊儿肥 !
  目录