CentOS6.5下安装Python3.6.5

  ⋅   :140  ⋅   :0  ⋅   杂七杂八

1.安装下列所需的依赖包: gcc zlib zlib-devel readline-devel

yum install zlib-devel
yum install readline-devel

注:readline-devel包用于解决退格键与方向键出现乱码的问题

2.下载Python3.6.5安装包并安装

wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
tar -xzvf Python-3.6.5.tgz
cd Python-3.6.5
mkdir /usr/local/python3
./configure --prefix=/usr/local/python3 #注:添加prefix前缀指定安装的目标路径
make && make install

3.建立新的软链接

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

4.测试运行

python3 --version
Python 3.6.5

 

如需评论,请填写表单。
换一个

记住我的信息