Install Python-3.1.2 For Linux
来源:互联网 发布:fanuc编程 编辑:程序博客网 时间:2024/06/05 16:22
python 下载地址:
http://xiazai.zol.com.cn/detail/33/320958.shtml
- 1: 解压
bunzip2 Python3.1.2.tar.bz2
- tar -xvf Python3.1.2.tar
- 2:安装到指定目录
sudo mkdir /usr/local/python3
- cd Python-3.1.2/
- ./configure –prefix=/usr/local/python3
- make & make install
- 3:查看版本
python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
(我本机自带了python2.7.6而此时并没覆盖老版本)
- 4:替换原有链接
mv /usr/bin/python /usr/bin/python_2.7.6
- /usr/local/python3/bin/python3 /usr/bin/python
- 5:查看版本
python
Python 3.1.2 (r312:79147, Dec 26 2017, 10:54:26)
[GCC 4.8.2] on linux3
Type “help”, “copyright”, “credits” or “license” for more information.
- 6:切换版本
/usr/bin/python_2.7.6
进入Python 2.7.6版本
如果嫌麻烦可以在$HOME/.bashrc 中添加一行
alias python2.7.6 = ‘/usr/bin/python_2.7.6’
保存并退出
source ~/.bashrc
之后输入python2.7.6即可进行版本切换
阅读全文