如何在已经存在python2的linux环境上安装python3
目录
如何在已经存在python2的linux环境上安装python3
python3终究会成为主流,但是呢如果在在linux中把python2卸载掉,会造成系统中其他需要python执行的程序异常。 所以今天,我们教大家怎么在已经存在python2的linux环境上安装python3。享受l新潮更简洁的的python3,也保留python2。
- python3.4的安装方法
[root@localhost install]# wget https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz
[root@localhost install]# tar -zxf Python-3.4.4.tgz
[root@localhost install]# cd Python-3.4.4
# 在安装包中有一个README的文件,里面有写如何安装
[root@localhost Python-3.4.4]# ls
aclocal.m4 config.sub configure.ac Grammar install-sh LICENSE Makefile.pre.in Modules Parser PCbuild Python setup.py
config.guess configure Doc Include Lib Mac Misc Objects PC pyconfig.h.in README Tools
[root@localhost Python-3.4.4]# ./configure
[root@localhost Python-3.4.4]# make
[root@localhost Python-3.4.4]# make install
- 现在来测试下
[root@localhost Python-3.4.4]# python3
Python 3.4.4 (default, Jul 7 2017, 17:12:28)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
以后执行python程序就可以使用python3 程序名 去执行了