centos6自带python2.6版本,根据需要,安装python2.7、easy_install-2.7、pip2.7

依赖

yum groupinstall -y Development tools
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

安装Python2.7

wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
tar xvf Python-2.7.11.tgz
cd Python-2.7.11
./configure --prefix=/usr/local
make && make install && echo OK

安装完后的Python的可执行文件目录是 /usr/local/bin
安装完后的python安装目录路径是 /usr/local/lib/python2.7

此时可通过python2.7命令验证安装

centos6.7 安装python2.7、pip2.7、easy_install-2.7的方法

安装 setuptools(easy_install-2.7) + pip2.7
注意:一定要使用 python2.7 来执行相关命令

# 下载setuptools,easy_install 的安装包
wget https://bootstrap.pypa.io/ez_setup.py

#安装easy_install-2.7
python2.7 ez_setup.py

#安装完成后/usr/local/bin/目录下出现easy_install-2.7

#安装pip2.7
easy_install-2.7 pip

#安装完成后/usr/local/bin/目录下出现pip2.7

#升级pip2.7版本
pip2.7 install --upgrade pip

至此easy_install-2.7、pip2.7安装完成

pip2.7 install [packagename]
pip2.7 install --upgrade [packagename]
pip2.7 uninstall [packagename]

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com