linux下python安装其他版本替换之前旧版本

来源:互联网 发布:os x 安装软件 编辑:程序博客网 时间:2024/05/14 22:02

1、下载linux版本的linux,上传到linux服务器

2、解压文件,比如tar -jxvf  XXX。tar。gz2

3、执行安装

cd到解压目录,编译安装,执行./configure  --prefix=/usr/local/python3     后边为执行安装的路径

执行make && make install

4、配置

默认情况下第三部不执行制定路径的时候安装可能会覆盖原来的版本,

如果需要目前的版本,执行

1、备份之前版本,

2、在建立新版本的链接

参见如下步骤

[root@localhost bin]#  /usr/bin/python
Python 2.4.3 (#1, Sep  3 2009, 15:37:12)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@localhost bin]#  /usr/bin/python
python     python2    python2.4 
[root@localhost bin]#  /usr/bin/python2.4
Python 2.4.3 (#1, Sep  3 2009, 15:37:12)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@localhost bin]# mv  /usr/bin/python /usr/bin/python_old
[root@localhost bin]# mv  /usr/bin/python2.4  /usr/bin/python2.4_old
[root@localhost bin]# ln -s /usr/local/python3/bin/python3 /usr/bin/python
[root@localhost bin]# python
Python 3.1.2 (r312:79147, May 22 2013, 11:51:45)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
0 0
原创粉丝点击