欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

詳解CentOS升級(jí)Python2.6到Python2.7并安裝pip

 更新時(shí)間:2017年03月30日 08:57:41   作者:admins  
本篇文章主要介紹了CentOS升級(jí)Python2.6到Python2.7并安裝pip,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。

現(xiàn)在大多數(shù)Centos6.x版本的系統(tǒng)python都是2.x,現(xiàn)因開發(fā)需求需要安裝前端代碼的構(gòu)建工具glue,故必須要做python版本的升級(jí)

升級(jí)python

系統(tǒng)默認(rèn)安裝的python是2.6.6的,我們需要升級(jí)到Python2.7

wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz 
tar xf Python-2.7.12.tar.xz
cd Python-2.7.12
./configure --enable-shared --enable-loadable-sqlite-extensions --with-zlib

其中--enable-loadable-sqlite-extensions是sqlite擴(kuò)展,如果需要使用的話則帶上這個(gè)選項(xiàng)之后執(zhí)行

vim ./Modules/Setup

找到

#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz,去掉前面的注釋符"#",然后進(jìn)行安裝和編譯
make && make install

安裝好Python2.7之后我們需要把Python2.6備份起來,然后在對(duì)yum的配置進(jìn)行修改,如果不修改的話,執(zhí)行yum命令將提示你的Python的版本不對(duì)

mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
vim /usr/bin/yum

將第一行的#!/usr/bin/python修改成#!/usr/bin/python2.6.6

現(xiàn)在執(zhí)行yum命令就不會(huì)報(bào)錯(cuò)了

python -v
error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

出現(xiàn)上面的錯(cuò)誤,編輯配置文件

echo "/usr/bin/lib" >> /etc/ld.so.conf
/sbin/ldconfig
/sbin/ldconfig -v

pip安裝

cd /usr/local/src
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
whereis pip

找到pip2.7的路徑,為其創(chuàng)建軟連接作為系統(tǒng)默認(rèn)的啟動(dòng)版本

ln -s /usr/local/bin/pip2.7 /usr/bin/pip

現(xiàn)在使用pip就能夠安裝各種包

pip install glue

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論