centos6自带python2.6版本,根据需要,安装python2.7、easy_install-2.7、pip2.7
依赖
yum groupinstall -y Development toolsyum 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.tgztar xvf Python-2.7.11.tgzcd Python-2.7.11./configure --prefix=/usr/localmake && make install && echo OK
安装完后的Python的可执行文件目录是 /usr/local/bin
安装完后的python安装目录路径是 /usr/local/lib/python2.7
此时可通过python2.7命令验证安装
安装 setuptools(easy_install-2.7) + pip2.7
注意:一定要使用 python2.7 来执行相关命令
# 下载setuptools,easy_install 的安装包wget https://bootstrap.pypa.io/ez_setup.py#安装easy_install-2.7python2.7 ez_setup.py#安装完成后/usr/local/bin/目录下出现easy_install-2.7#安装pip2.7easy_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]
新闻热点
疑难解答