• Linux下python开发环境的准备


    升级python

     安装依赖:

      yum install lrzsz zlib zlib-devel  openssl  readline-deve gcc  ibffi-devel python-devel openssl-devel  mysql-devel libxml2 libxml2-dev libxslt*  -y

    1、安装gcc,用于编译Python源码
    yum install gcc
    2、下载源码包,https://www.python.org/ftp/python/
    3、解压并进入源码文件
    4、编译安装
    ./configure
    make all
    make install
    5、查看版本
    /usr/local/bin/python2.7 -V
    6、修改默认Python版本
    mv /usr/bin/python /usr/bin/python2.6
    ln -s /usr/local/bin/python2.7 /usr/bin/python
    7、防止yum执行异常,修改yum使用的Python版本
    vi /usr/bin/yum
    将头部 #!/usr/bin/python 修改为 #!/usr/bin/python2.6

    安装pip

    wget https://bootstrap.pypa.io/get-pip.py

    python get-pip.py

    pip install paramiko

    (1)下载setuptools包
    # wget http://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz
    (2)解压setuptools包
    # tar zxvf setuptools-2.0.tar.gz
    # cd setuptools-2.0
    (3)编译setuptools
    # python setup.py build
    (4)开始执行setuptools安装
    # python setup.py install

     python自动补全

    #!/usr/bin/env python
    #-*-coding:utf-8-*-
    import sys
    import readline
    import rlcompleter
    import atexit
    import os
    readline.parse_and_bind('tab: complete')
    histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
    try:
            readline.read_history_file(histfile)
    except IOError:
            pass
    atexit.register(readline.write_history_file, histfile)
    del os, histfile, readline, rlcompleter
    

      

  • 相关阅读:
    分布式系统之CAP理论杂记
    RPC详解
    玩转zookeeper命令
    NRPE介绍
    开启irqbalance提升服务器性能
    xinetd被动服务唤醒
    服务发现的基本原理[转]
    关于TCP/IP,必知必会的十个经典问题[转]
    Smart Client技术简要总结
    使用ng-grid实现可配置的表格
  • 原文地址:https://www.cnblogs.com/along1226/p/5602469.html
Copyright © 2020-2023  润新知