昊天SEO

搭建或者升级Python环境笔记

!/bin/bash
#搭建python环境步骤
#
#添加sudo用户
#第一步:环境准备
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers sqlite-devel libaio libaio-devel 

#第二步:升级python2.6至python2.7.10
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar -xvf Python-2.7.10.tgz
cd Python-2.7.10
mkdir /usr/local/python2.7
./configure  #等待编译完成
make&&make install

#以下非必须

#mv /usr/bin/python /usr/bin/python2.6 #将原版本的python更换一个名字
#ln -s /usr/local/bin/python2.7 /usr/bin/python
#python -V

vi /usr/bin/yum

#!/usr/bin/python修改为系统原有的python版本地址#!/usr/bin/python2.6

#第三步:安装pip
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-18.2.tar.gz
tar xzvf setuptools-18.2.tar.gz
cd setuptools-18.2
python setup.py install
easy_install pip

#########或者手动安装pip############
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz
tar xzvf pip-7.1.2.tar.gz
cd pip-7.1.2
python setup.py install

本文地址官网    新乡网站建设,seo

分享到:更多 ()
a