云服务器centos系统安装python

1、查看python的版本

$ cd /usr/bin/
$ ls python*
$ ls -al python* //查看依赖关系

2、如果版本不合适可以卸载python再重新安装

# 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(改成上述的一样)

3、安装pip

wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
python get-pip.py
可直接查看配置链接   http://www.cnblogs.com/konglingxi/p/9722351.html

 

转载于:https://www.cnblogs.com/wuyan717/p/9679496.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值