Centos 6.4 安裝Python 2.7 python-pip的詳細(xì)步驟
1. 準(zhǔn)備工作
下載源碼包
wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
查看是否安裝make工具
~#rpm -qa|grep make automake-1.11.1-4.el6.noarch make-3.81-20.el6.x86_64
如果沒有安裝make工具
yum -y install gcc automake autoconf libtool make
查看是否安裝zlib庫
~#rpm -qa|grep zlib zlib-devel-1.2.3-29.el6.x86_64 zlib-1.2.3-29.el6.x86_64
安裝zlib
yum install zlib-devel
檢查是否安裝ssl 庫
~#rpm -qa|grep openssl openssl-devel-1.0.1e-16.el6_5.x86_64 openssl-static-1.0.1e-16.el6_5.x86_64 openssl098e-0.9.8e-17.el6.centos.2.x86_64 openssl-1.0.1e-16.el6_5.x86_64 openssl-perl-1.0.1e-16.el6_5.x86_64
安裝openssl
yum install openssl*
安裝bzip2依賴庫
yum install -y bzip2*
2. 編譯安裝
cp Python-2.7.3.tar.bz2 /usr/src/ tar -jxvf Python-2.7.3.tar.bz2 vi Modules/Setup.dist
找到
#SSL=/usr/local/ssl #_ssl _ssl.c \ # -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ # -L$(SSL)/lib -lssl -lcrypto ...... #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
把注釋去掉
編譯
./configure --prefix=/usr/local/python2.7 make all make install make clean make distclean
安裝成功
~#/usr/local/python2.7/bin/python2.7 Python 2.7.3 (default, Dec 18 2013, 15:43:35) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
cd /usr/local/python2.7 python setup.py install
建立python2.7 軟鏈
~#mv /usr/bin/python /usr/bin/python.bak ~#ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python2.7 ~#ln -s /usr/bin/python2.7 /usr/bin/python
3. 解決yum無法使用的問題
~#yum update There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: No module named yum Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.7.3 (default, Dec 18 2013, 15:43:35) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] If you cannot solve this problem yourself, please go to the yum faq at: http://yum.baseurl.org/wiki/Faq
因為centos 6.4 下yum默認(rèn)使用的是python2.6
vi /usr/bin/yum ---------------------------------------------------- #!/usr/bin/python import sys try: import yum except ImportError: .......
修改為
#!/usr/bin/python2.6 ........
4. 安裝python-pip工具
先安裝setup-tools
wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg --no-check-certificate chmod +x setuptools-0.6c11-py2.7.egg sh setuptools-0.6c11-py2.7.egg
安裝pip
wget https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz --no-check-certificate cp pip-1.3.1.tar.gz /usr/src/ tar zxvf pip-1.3.1.tar.gz cd pip-1.3.1 python setup.py install ln -s /usr/local/python2.7/bin/pip /usr/bin/pip
相關(guān)文章
Apache添加多端口及實現(xiàn)單ip多端口映射的方法
這篇文章主要介紹了Apache添加多端口及實現(xiàn)單ip多端口映射的方法的相關(guān)資料,需要的朋友可以參考下2016-02-02linux下獲取當(dāng)前時間的相關(guān)函數(shù)
這篇文章主要介紹了linux下獲取當(dāng)前時間的相關(guān)函數(shù),具有很好的參考價值,希望對大家有所幫助,2023-09-09在linux系統(tǒng)下部署selenium爬蟲程序介紹
大家好,本篇文章主要講的是在linux系統(tǒng)下部署selenium爬蟲程序介紹,感興趣的同學(xué)速來圍觀哦,記得收藏本篇文章方便下次瀏覽2021-11-11解決-BASH: /HOME/JAVA/JDK1.8.0_221/BIN/JAVA: 權(quán)限不夠問題
這篇文章主要介紹了解決-BASH: /HOME/JAVA/JDK1.8.0_221/BIN/JAVA: 權(quán)限不夠的問題,需要的朋友可以參考下2019-09-09如何在CentOS8上安裝和配置Postfix郵件服務(wù)器的方法示例
這篇文章主要介紹了如何在CentOS8上安裝和配置Postfix郵件服務(wù)器的方法示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11