安装Python2.7

本文介绍了如何从源码下载并编译安装 Python 2.7.13 版本,包括必要的依赖包安装、配置环境变量、安装 easy_install 工具及设置 pip 的国内源等步骤。

 

一、下载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

  

 

转载于:https://www.cnblogs.com/mm200p/p/6554975.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值