Centos配置python过程

  1. 安装nano

    yum install nano

  2. 更新python并修改’python’的软连接

    (1)更新软件

    yum update

    额外的软件扩展源,epel扩展源

    sudo yum -y install epel-release

    安装完之后别忘了清除一下cache

    sudo yum clean all

    (2)下载python

    cd /usr/local/src

    wget https://www.python.org/ftp/python/3.6.1/Python3.6.1.tgz

    tar xvf Python-3.6.1.tgz

    cd Python-3.6.1

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

    tar xvf Python-2.7.13.tgz

    cd Python-2.7.13

    (3)编译安装

    ./configure

    make all

    make install

    make clean

    make distclean

    rm /usr/bin/python

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

    另一种安装方式

    tar jxvf Python-3.3.3.tar.bz2 -C /usr/local/src/

    cd /usr/local/src/Python-3.3.3/

    ./configure –prefix=/usr/local/Python-x.x.x

    make && make install

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

    ln -s /usr/local/python3.3/bin/python3.3 /usr/bin/python

    软连接:路径要写全,并且不要忘了路径最前面的/

    在centos系统下更改了python得软连接yum就会挂掉

    解决:

    /usr/bin/yum

    #修改 yum中的python

    将第一行 #!/usr/bin/python 改为 #!/usr/bin/pythonx.x

(4)安装python库

pip install requests

django

web.py

Comments

No comments yet. Why don’t you start the discussion?

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注