CentOS6.5下安装Python3

发布时间:2019-10-21 09:09:36编辑:auto阅读(4304)

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

    # yum install zlib-devel
    # yum install readline-devel

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

    2.下载Python3.6.2安装包

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

    3.解压安装包

    # tar -xzvf Python-3.6.2.tgz

    4.进入目录

    # cd Python-3.6.2

    5.配置、检查依赖

    # ./configure --prefix=/usr/local/python3

    注:添加prefix前缀指定安装的目标路径

    6.编译&安装

    # make && make install

    7.建立新的软链接

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

    8.测试运行

    # python3 --version
    # python3

关键字