学习的中年人

安装Python2.7

 

一、下载Python源码

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

  tar xf Python-2.7.13.tgz

  cd Python-2.7.13

 

二、编译

  yum install openssl openssl-devel zlib zlib-devel libffi-devel libffi libxml2 libxml2-devel libxslt libxslt-devel tcl-devel tk-devel sqlite-devel

  ./configure --prefix=/usr/local --with-zlib-dir=/usr/lib64 --with-ensurepip=install --enable-loadable-sqlite-extensions

  make

  make altinstall  # 不会覆盖系统默认python

 

三、安装easy_install

  wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py

  python2.7 ez_setup.py

 

四、pip使用国内源

  vi ~/.pip/pip.conf

[global]
timeout = 6000
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
use-mirrors = true
mirrors = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com

  

 

posted on 2017-03-15 16:37  学习的中年人  阅读(233)  评论(0编辑  收藏  举报

导航