VPS 的 CentOS6 升级 Python 的方法
VPS 的 CentOS6 升级 Python 的方法
centos默认安装python2.6。由于python和centos关联紧密,所以不建议卸载,进行编译升级
1.新开的VPS务必系统更新
yum -y update
yum groupinstall -y development or; yum groupinstall -y 'development tools'
yum install -y zlib-dev zlib-devel openssl-devel sqlite-devel bzip2-devel xz-libs
2.升级python>=2.7
编译参看: https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
wget http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz
xz -d Python-2.7.6.tar.xz
tar -xvf Python-2.7.6.tar
xz -d Python-3.3.3.tar.xz
tar -xvf Python-3.3.3.tar
# Enter the file directory:
cd Python-2.7.6
# Start the configuration (setting the installation directory)
# By default files are installed in /usr/local.
# You can modify the --prefix to modify it (e.g. for $HOME).
./configure --prefix=/usr/local
cd Python-3.3.3
./configure
为了不覆盖系统默认选项 - 替换系统正在使用的PYTHON- 我们使用 make altinstall.
# Let's build (compile) the source
# This procedure can take awhile (~a few minutes)
make
# After building everything:
make altinstall
Example for version 3.3.3:
make && make altinstall # <--- Two commands joint together
我们直接进行
make
make install
3.建立软连接
编译的软件安装于 /usr/local/bin/python2.7
所以需要替换原来的 /usr/bin/python
mv /usr/bin/python /usr/bin/python2.6
rm /usr/bin/python
ln -s /usr/local/bin/python2.7 /usr/bin/python
vim /usr/bin/yum
/usr/bin/python 改成 /usr/bin/python2.6
4.更新 pip
https://bootstrap.pypa.io/get-pip.py
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py
ln -s /usr/local/bin/pip /usr/bin/pip
如果wget下载不了这文件,可能是DNS解析问题,需要下载个文件
vi /etc/resolv.conf
nameserver 8.8.4.4
nameserver 8.8.8.8
VPS 的 CentOS6 升级 Python 的方法的更多相关文章
- centos6升级python
CentOS 6中,默认安装了Python 2.6.而pip,jupyter这样的常用工具是不支持Python 2.6的.为了使用这些工具,就必须将Python 2.6升级到Python 2.7以上的 ...
- centos6升级python版本至python3.5
一. 从Python官网到获取Python3的包, 切换到目录/usr/local/src wget https://www.python.org/ftp/python/3.5.1/Python-3. ...
- CentOS升级Python的方法
centOS内核版本为:3.10.101-1.el6.elrepo.x86_64 1,下载Python安装包 wget http://www.python.org/ftp/python/2.7.6/P ...
- CentOS6 系统下升级python后yum命令使用时报错
CentOS6 系统下升级python后yum命令使用时报错,如下: [root@xxxxxxx]#yumFile"/usr/bin/yum",line30exceptKeyboa ...
- centos6.5升级python为2.7
今天线上服务器全部升级python环境为python-2.7.6的环境,我采用的方法是ansible+shell,代码如下,友提,Python-2.7.6.tgz.setuptools-14.3.1. ...
- 升级python导致yum报错的解决方法
把python从2.7升级到3.6后 , 使用yum报错 File ‘’/usr/bin/yum'', line 30 except KeyboardInterrupt, e: ^ 故障原因:yum采 ...
- 记一次centos6升级salt-minion启动失败的问题
记一次centos6升级salt-minion启动失败的问题 作者:耀耀 blog:https://www.liuyao.me 一.起因 升级Salt-minion后 使用/etc/init.d/sa ...
- Linux 下编译升级 Python
一.Centos下升级python3.4.3 1.下载安装 wget http://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz wget http ...
- 升级python到2.7版本pip不可用
升级python到2.7版本pip不可用 [root@localhost pip-7.1.2]# pip Traceback (most recent call last): File "/ ...
随机推荐
- 学习参考《矩阵分析与应用(第二版)张贤达》PDF
要想深入理解机器学习,或者对人工智能的某个领域有所研究,都必须掌握矩阵及其应用. 学习<矩阵分析与应用第2版>时,会发现总结了大量线性代数的知识,主要是给工科生用的.归纳了不少论文中的解法 ...
- JAVA工程命名规范
Java推荐的包声明命名约定是反向域名. 例如 - com.abysm.myproject
- linux ifconfig找不到
提示命令不存在 原因: 系统默认的环境变量设置不对 而,ifconfig恰恰就在/sbin里面. 下cat /etc/profile, 可以发现没有关于/sbin的环境变量. Linux,习惯用ged ...
- [Python] String Join
Let's introduce a new string method, join: >>> nautical_directions = "\n".join([& ...
- React Native入门——IDE及其它相关基础技术
关于React Native的开发,当中一个问题是缺少好用的IDE,有些人说不就是JS么,搞一个记事本也就写了,那样尽管牛逼,但事实上还是非常头大的,有一款好的IDE还是能提升开发效率的,这里对几个还 ...
- 关于app.FragmentManager和v4包的FragmentPagerAdapter冲突
这几天发现一个问题我用getFragmentManager()得到FragmentManager不能放到FragmentPagerAdapter里面去.由于FragmentPagerAdapter里面 ...
- Android圆形图片不求人,自定义View实现(BitmapShader使用)
在很多APP当中,圆形的图片是必不可少的元素,美观大方.本文将带领读者去实现一个圆形图片自定View,力求只用一个Java类来完成这件事情. 一.先上效果图 二.实现思路 在定义View 的onMea ...
- | 插件下载陈磊SQL MD5 加密
简介:SQL MD5 加密 下述是 SQL Server 中 MD5加密 16位和32位的 ,)) ,ModifiedOn=null ; ,)) ,ModifiedOn=null ;
- Strtus2学习
Struts 2 体系结构 : 1.Web浏览器请求一个资源. 2.过滤器Dispatcher查找方法,确定适当的Action. 3.拦截器自动对请求应用通用功能,如验证和文件上传操作. 4.Acti ...
- JSP_Learn
// 解决中文乱码的问题String name = new String((request.getParameter("name")).getBytes("ISO-885 ...