雲服務器centos系統安裝python

一、查看python的版本html

$ cd /usr/bin/
$ ls python*
$ ls -al python* //查看依賴關係

二、若是版本不合適能夠卸載python再從新安裝node

# rpm -qa|grep python|xargs rpm -e --allmatches --nodeps   # 卸載python
# wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz 下載python2.7
# tar -zxvf Python-2.7.12.tgz  # 解壓
# 將解壓的文件放到python2文件夾中
# cd python2
# ./configure
若是報:Bash . configure permission denied的錯誤,則先運行 #chmod +x ./configure
再運行 ./configure
 
  

  

# make 
# sudo make install # 創建python軟鏈接
# ln
-s /usr/local/bin/python /usr/bin/python // ln -s 新安裝的python路徑 系統python路徑
# 若是提示 ln: creating symbolic link `/usr/bin/python': File exists
# mv /usr/bin/python /usr/bin/python_old // 去除原來存在的軟鏈接
# ln -s /usr/local/bin/python /usr/bin/python //再精選軟鏈接
# vim /usr/bin/yum //將第一行改爲 #!/usr/bin/python2.7(具體改爲什麼使用whereis python看看python的路徑,實在不知道是那個的時候能夠用最笨的辦法
一個個試過),改變yum對python的指向路徑
# yum list python #查看指向是否成功,若是沒有成功會報 No module named yum 的錯誤
# vim /usr/libexec/urlgrabber-ext-down //將第一行改爲 #!/usr/bin/python2.7(改爲上述的同樣)

三、安裝pippython

wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
python get-pip.py
可直接查看配置連接   http://www.cnblogs.com/konglingxi/p/9722351.html
相關文章
相關標籤/搜索