网上看到superset,比较感兴趣,虚机上搭一下,记录操作过程。

版本信息:CentOS 6.6 + python 2.7.12 + mysql 5.1.73 + setuptools 36.5.0 + pip-9.0.1

1、升级Python

安装虚机操作CentOS6.6的系统环境,过程略,运行如下脚本(替换yum源、升级Python、安装Python setuptools、pip)

#!/bin/bash
#####################################################################################
#基础设置:
#    启用163yum源
#    升级Python
#    
#
#####################################################################################
v_down_tools=~/down_loads

yum -y gcc gcc-c++ make cmake openssl openssl-devel zlib zlib-devel

[[ ! -d ${v_down_tools} ]] && mkdir -p ${v_down_tools}

###################################启用163yum源######################################
yum_upgrade_163(){
    cd ${v_down_tools}
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    if `grep -q 'release 5' /etc/redhat-release` ; then
        OS_version='CentOS5'
    elif  `grep -q 'release 6' /etc/redhat-release` ; then
        OS_version='CentOS6'
    elif  `grep -q 'release 7' /etc/redhat-release` ; then
        OS_version='CentOS7'
    fi
    wget -N http://mirrors.163.com/.help/${OS_version}-Base-163.repo
    mv ${OS_version}-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo
    yum clean all
    yum makecache
}

##################################升级Python###########################################
python_upgrade(){
    # 安装Python包
    cd ${v_down_tools}
    wget -N  https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
    tar -xf Python-2.7.12.tar.xz
    if [ -d Python-2.7.12 ]
    then
        cd Python-2.7.12
        ./configure --prefix=/usr/local/python-2.7.12
        make && make install
        mv /usr/bin/python /usr/bin/python_backup
        #ln -s /usr/local/python-2.7.12 /usr/local/python
        ln -s /usr/local/python-2.7.12/bin/python /usr/bin/python2.7
        ln -s /usr/local/python-2.7.12/bin/python /usr/bin/python
        ln -s /usr/local/python-2.7.12/lib/python2.7 /usr/lib/python2.7
        ln -s /usr/local/python-2.7.12/lib/python2.7 /usr/lib/python
        ln -s /usr/local/python-2.7.12/lib/python2.7 /usr/lib64/python2.7
        ln -s /usr/local/python-2.7.12/lib/python2.7 /usr/lib64/python
    fi
    ##设置yum,注意sed的分隔符这里用了|
    sed -i "s|#!/usr/bin/python|#!/usr/bin/python2.6|g" /usr/bin/yum 
    ##添加环境变量
    echo 'export PYTHON_HOME=/usr/local/python-2.7.12' >> /etc/profile
    echo 'export PATH=$PATH:$PYTHON_HOME/bin' >> /etc/profile
    source /etc/profile

}

python_setuptools_pip{
    cd ${v_down_tools}
    ##安装setuptools,注意先安装setuptools才能再安装pip
    wget https://pypi.python.org/packages/a4/c8/9a7a47f683d54d83f648d37c3e180317f80dc126a304c45dc6663246233a/setuptools-36.5.0.zip#md5=704f500dd55f4bd0be905444f3ba892c
    unzip setuptools-36.5.0.zip 
    cd setuptools-36.5.0
    #python setup.py --help
    python setup.py build 
    python setup.py install

    cd ${v_down_tools}
    ##安装pip
    wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
    tar -xf pip-9.0.1.tar.gz 
    cd pip-9.0.1
    #python setup.py -h
    python setup.py build
    python setup.py install

    ##升级
    #pip install --upgrade setuptools pip

}


main(){
    yum_upgrade_163
    python_upgrade
    python_setuptools_pip
}
main
View Code

相关文章:

  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2021-11-22
  • 2021-07-31
  • 2021-06-18
猜你喜欢
  • 2021-12-01
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-01-25
相关资源
相似解决方案