云服务器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
相关文章
相关标签/搜索