zoukankan      html  css  js  c++  java
  • 升级Linux上的Python环境

    升级Linux上的Python环境

    安装依赖

    [root@server02 ~]# yum -y install zlib unzip zlib-devel gcc make wget lrzsz
    

    安装sqlite

    [root@server02 opt]# wget https://www.sqlite.org/2017/sqlite-autoconf-3170000.tar.gz --no-check-certificate
    [root@server02 opt]# tar xvf  sqlite-autoconf-3170000.tar.gz
    [root@server02 opt]# cd sqlite-autoconf-3170000
    [root@server02 sqlite-autoconf-3170000]# ./configure --prefix=/home/ctchat/sqlite3 --disable-static --enable-fts5 --enable-json1 CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_RTREE=1"
    ... ...
    config.status: creating sqlite3.pc
    config.status: executing depfiles commands
    config.status: executing libtool commands
    [root@server02 sqlite-autoconf-3170000]# 
    [root@server02 sqlite-autoconf-3170000]# make
    [root@server02 sqlite-autoconf-3170000]# make install 
    ... ...
     /usr/bin/install -c -m 644 sqlite3.1 '/home/ctchat/sqlite3/share/man/man1'
     /bin/mkdir -p '/home/ctchat/sqlite3/lib/pkgconfig'
     /usr/bin/install -c -m 644 sqlite3.pc '/home/ctchat/sqlite3/lib/pkgconfig'
    make[1]: Leaving directory `/opt/sqlite-autoconf-3170000'
    

    安装Python-3.6

    [root@server02 opt]# cd /opt
    [root@server02 opt]# tar -zxvf Python-3.6.0.tgz
    [root@server02 opt]# cd Python-3.6.0
    [root@server02 Python-3.6.0]# LD_RUN_PATH=/home/ctchat/sqlite3/lib ./configure --prefix=/home/ctchat/python3 LDFLAGS="-L/home/ctchat/sqlite3/lib" CPPFLAGS="-I /home/ctchat/sqlite3/include" 
    [root@server02 Python-3.6.0]# LD_RUN_PATH=/home/ctchat/sqlite3/lib make 
    [root@server02 Python-3.6.0]# LD_RUN_PATH=/home/ctchat/sqlite3/lib make install
    [root@server02 Python-3.6.0]# mv  /usr/bin/python /usr/bin/python2.6.bak 
    [root@server02 Python-3.6.0]# ln -s /home/ctchat/python3/bin/python3.6  /usr/bin/python
    [root@server02 Python-3.6.0]# sed -ri 's@^#!/usr/bin/python.*@#!/usr/bin/python2.6@g' /usr/bin/yum  
    

    安装setuptools、psutil、升级pip

    [root@server02 opt]# unzip setuptools-38.6.0.zip
    [root@server02 opt]# python setup.py install
    [root@server02 setuptools-38.6.0]# cd /opt
    [root@server02 opt]# tar -xf pip-9.0.1.tar.gz
    [root@server02 opt]# cd pip-9.0.1
    [root@server02 pip-9.0.1]# python setup.py install 
    [root@server02 pip-9.0.1]# ln -s /home/ctchat/python3/bin/pip3  /usr/bin/pip
    [root@server02 pip-9.0.1]# mkdir ~/.pip/
    [root@server02 pip-9.0.1]# cd  ~/.pip/
    [root@server02 .pip]# touch ~/.pip/pip.conf
    [root@server02 .pip]# cat > ~/.pip/pip.conf << EOF
    [global]
    index-url = http://mirrors.aliyun.com/pypi/simple/ 
    [install]
    trusted-host=mirrors.aliyun.com 
    EOF
    [root@server02 .pip]# pip install --upgrade pip
    [root@server02 .pip]# pip install psutil
    [root@server02 .pip]# python -V
    Python 3.6.0
    
  • 相关阅读:
    MOSS项目开发 周记(第十四周)
    MOSS项目开发 周记(第十七周)
    MOSS项目开发 周记(第十一周)
    MOSS项目开发 周记(第九周)
    MOSS项目开发 周记(第十三周)
    MOSS项目开发 周记(第十周)
    MOSS项目开发 周记(第十二周)
    MOSS项目开发 周记(第十六周)
    php中echo(),print(),print_r()的区别
    11个有用的移动网页开发App和HTML5框架
  • 原文地址:https://www.cnblogs.com/Wshile/p/12876498.html
Copyright © 2011-2022 走看看