CentOS6.7升级Python3.4.3

1、检查现有python版本

[root@xu  ~]# python -V

Python 2.6.6

[root@xu  ~]#

2、下载Python3.4.3

下载并上传到tmp目录

[root@xu  tmp]# ls

Python-3.4.3.tgz  yum.log

[root@xu  tmp]#

3、创建Python安装目录

[root@xu  tmp]# mkdir /opt/python3.4

4、解压tar文件

[[email protected] tmp]# tar -zxvf Python-3.4.3.tgz

[[email protected] tmp]# cd Python-3.4.3

[[email protected] Python-3.4.3]# pwd

/tmp/Python-3.4.3

5、配置及安装

[[email protected] Python-3.4.3]# ./configure --prefix=/opt/python3.4/

[[email protected] Python-3.4.3]# make

[[email protected] Python-3.4.3]# make install

6、建立软连接,使系统默认python指向新安装的python

[[email protected] tmp]# mv /usr/bin/python /usr/bin/python2.6.6

[[email protected] tmp]# ln -s /opt/python2.7/bin/python2.7 /usr/bin/python

[[email protected] tmp]# python -V

Python 3.4.3

不错,到此升级成功,然后编辑yum默认的python为旧版本python

[[email protected] tmp]# vim /usr/bin/yum

修改第一行,如下

修改前:#!/usr/bin/python

修改后:#!/usr/bin/python2.6.6

保存退出:(vim命令):wq

注意:现在还没有安装easy_install和pip,且安装好后需要配置环境变量

下载setuptools-18.3.2.tar.gz

解压并安装

[[email protected] tmp]# tar -zxvf setuptools-18.3.2.tar.gz

[[email protected] setuptools-18.3.2]# python setup.py install

安装pip

[[email protected] tmp]# easy_install pip

-bash: easy_install: command not found

配置python环境变量

[[email protected] tmp]# vim /etc/profile

在最后面加上

PYTHON_HOME=/opt/python3.4

export PATH=$PYTHON_HOME/bin:$PATH

保存退出

[[email protected] tmp]# source /etc/profile

执行上面命令,是环境变量立即生效

安装pip

[[email protected] tmp]# easy_install pip

Searching for pip

Best match: pip 6.0.8

Adding pip 6.0.8 to easy-install.pth file

Installing pip script to /opt/python3.4/bin

Installing pip3.4 script to /opt/python3.4/bin

Installing pip3 script to /opt/python3.4/bin

Using /opt/python3.4/lib/python3.4/site-packages

Processing dependencies for pip

Finished processing dependencies for pip

到此ok,python升级完成,easy_install和pip命令可以正常使用

时间: 2024-12-07 14:09:54

CentOS6.7升级Python3.4.3的相关文章

centos6.5升级python3并配置pip

centos安装完成之后,第一件事就是安装python,但是linux一般都默认自带python2.6或者2.7,但是一些新的包不支持旧版本的python,因此需要对python进行升级.  参考链接:https://blog.csdn.net/qq_36288025/article/details/82534508 1.安装python之前需要安装一堆依赖包,虽然不知道干什么的,但是不安装会出错哦! yum install zlib-devel bzip2-devel openssl-deve

CentOS-6.9升级到Python-3.5

CentOS-6.9升级Python到3.5 下载Python-3.5 wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz 解压 tar zxvf Python-3.5.0.tgz 进入Python-3.5.0目录 cd Python-3.5.0 指定安装位置 ./configure --prefix=/usr/local/python3.5 编译安装 make && make install 下载并安装setupto

ubuntu下卸载python2和升级python3.5

卸载python只需一条语句就可以实现 sudu apt-get remove python ubuntu下安装python3 sudo apt-get install python3 但这样只安装了python3.4 要想使用python3.5,则必须升级python3.4 sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update sudo apt-get install python3.5 使用以上三行命令便可升级py

CentOS 5.5 x64下安装升级Python3.3

1.下载linux版本的Python3.3.5,以下是我共享的百度云盘的下载地址 http://pan.baidu.com/s/1kT3IHLH 2.解压: tar -zxvf Python-3.3.5.tgz 3.进入解压后的目录: cd Python-3.3.5 4.创建安装目录,这里我将其安装在/usr/local下 mkdir /usr/local/python3.3 5.编译python3.3 ./configure --prefix=/usr/local/python3.3 6.执行

centos6.3升级python至2.7.5

centos6.3自带的python版本是2.6.6,有时候需要升级到2.7.这里记录一下升级过程,方便查阅.实际上是转载自http://flyingdutchman.iteye.com/blog/1885564. 1.安装gcc. yum install gcc gcc-c++ 2.下载python-2.7.5.tar.xz. wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.xz 3.解压安装 xz -d python

CentOS6.X升级Python

CentOS6.X升级Python CentOS6.X升级默认Python2.6.6到python2.7 在centos下直接输入python即可进入python,能看到当前版本信息 [[email protected] ~]# pythonPython 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2Type "help", "copyright

CentOS6.5升级内核到4.0.0

4月12日,Linux内核4.0正式发布 主要更新内容如下:新增“实时内核补丁”.无需重启,实时修补内核.该特性由 Red Hat的Kpatch 和 SUSE 的 kGraft 合并形成.改进硬件支持.新增对Intel Quark SoC 以及更多 ARM设备的支持,改进对IBM z13的支持. 为(xian)了(de)尝(dan)鲜(teng),将CentOS6.5升级内核到4.0.0. 1. 准备工作 确认内核及版本信息 [[email protected] send]# uname -r2

centos6.5升级gcc 4.4.7为最新版4.9.1(不建议!!!)

=====================本方法切实可行======不建议用======================================== 1.下载源码包 我的下载  gcc-4.9.1.tar.bz2 解压:tar -jxvf gcc-4.9.1.tar.bz2 2.下载编译所需依赖库 cd gcc-4.9.1 ./contrib/download_prerequisites   此命令会自动安装依赖包,直接安装到本目录下,并且自动解压,make时会用到 cd .. 3.建立

centos6.5升级到centos7

redhat提供了一个redhat-upgrade-tool的升级工具: [1]配置软件源 # vim /etc/yum.repos.d/upgrade.repo [upgrade] name=upgrade baseurl= enable=1 gpgcheck=0 [2]安装软件工具 yum -y install preupgrade-assistant-contents redhat-upgrade-tool preupgrade-assistant [3]升级前检查潜在问题 # preup