1 #升级前必须先安装其它依赖 2 yum install readline-devel sqlite-devel bzip2-devel openssl-devel gdbm-devel libdbi-devel ncurses-libs zlib-devel -y 3 #下载python安装包 4 wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz 5 tar -zxvf Python-2.7.6.tgz 6 cd Python-2.7.6 7 ./configure --prefix=/usr/local/python2.7 8 make && make install 9 make clean 10 make distclean 11 #移除旧的Python链接 12 mv /usr/bin/python /usr/bin/python2.6.6 13 14 ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python 15 #安装setuptools 16 cd .. 17 wget http://pypi.douban.com/packages/source/s/setuptools/setuptools-12.0.5.tar.gz 18 tar zxvf setuptools-12.0.5.tar.gz 19 cd setuptools-12.0.5 20 python setup.py build 21 python setup.py install 22 #手动设置环境变量 23 #vi /etc/profile 24 #添加如下内容: 25 #PY_EZ=/usr/local/python2.7 26 #export PATH=$PY_EZ/bin:$PATH 27 #source /etc/profile # 当前终端生效,reboot后才会完全生效 28 #echo $PATH 29 #查找easy_install 30 #find / -name easy_install 31 #ln -s /usr/local/python2.7/bin/easy_install /usr/bin/easy_install 32 #easy_install pip 33 #find / -name pip 34 #
时间: 2024-10-12 01:06:17