Centos7安装python

源码包安装python

1. 下载python包下载Python-3.6.1.tar.xz包需要翻墙

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

2.解压 Python-3.6.1.tar.xz

# tar xvf Python-3.6.1.tar.xz

3. 编译

# ./configure --prefix=/usr/local/python3 --enable-shared
# make && make install

4. centos7默认安装python,注掉

# mv /usr/bin/python /usr/bin/python.bak

5. 创建链接

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

你可能感兴趣的:(Centos7安装python)