云服务器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
# 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 //再精选软连接

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

猜你喜欢

转载自www.cnblogs.com/wuyan717/p/9679496.html