欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

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

程序员文章站 2022-05-22 23:19:39
centos6自带python2.6版本,根据需要,安装python2.7、easy_install-2.7、pip2.7 依赖 yum groupinstal...

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]