Jolson's Blog

CentOS 6.6下源码编译安装Python

  1. 准备安装模块

    1
    2
    yum groupinstall "Development tools"
    yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
  2. Python3.4 安装下载代码 configure → make → make altinstall

    1
    2
    3
    4
    5
    6
    cd /usr/local/src
    wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz
    tar -zxvf Python-3.4.3.tgz
    cd Python-3.4.3
    ./configure --prefix=/usr/local/python
    make && make altinstall
  3. 安装Python3.4 :公用库的安装

    1
    2
    echo "/usr/local/python/lib" >> /etc/ld.so.conf
    ldconfig
  4. 安装Python3.4: 4. /usr/local/bin/

    1
    ln -s /usr/local/python/bin/python3.4 /usr/local/bin/python
  5. 安装Python3.4 :5. 确认是否安装正确

    1
    2
    /usr/local/python/bin/python3.4 -V
    python -V
  6. 安装Python3.4 Easy_Install

    1
    2
    3
    4
    5
    6
    cd /usr/local/src
    wget https://pypi.python.org/…/s/setuptools/setuptools-18.0.1.zip
    unzip setuptools-18.0.1.zip
    cd setuptools-18.0.1
    /usr/local/bin/python setup.py install
    ln -s /usr/local/python/bin/easy_install /usr/local/bin/easy_install
  7. 安装Python3.4 :Pip

    1
    2
    /usr/local/bin/easy_install pip
    ln -s /usr/local/python/bin/pip /usr/local/bin/pip
  8. 安装Python3.4: Virtualenv

    1
    2
    pip install virtualenv
    ln -s /usr/local/python/bin/virtualenv /usr/local/bin/virtualenv
  9. 安装Python3.4 :Virtualenvwrapper

    1
    pip install virtualenvwrapper
  10. 安装Python3.4 :参数设定$

    1
    2
    3
    4
    5
    vim ~/.bashrc
    if [ -f /usr/local/python/bin/virtualenvwrapper.sh ]; then
    export WORKON_HOME=$HOME/.virtualenvs
    source /usr/local/python/bin/virtualenvwrapper.sh
    fi