- A+
所属分类:Python
Windows
Linux
Linux的yum下载的是python2.6,为防止错误,此处更新下载一个Python3.x,查看Python版本:python -V
提示:更新下载其实就是重新安装一下Python
1.安装gcc,用于编译Python源码
- yum -y install gcc
2.下载源码包
- wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz
- ##各版本下载地址:https://www.python.org/ftp/python/
3.解压编译安装
- tar xf Python-3.5.3.tgz -C /usr/local/
- cd /usr/local/Python-3.5.3
- ./configure
- make all
- make install
4.查看版本
- /usr/local/bin/python3.5 –V
- Python 3.5.3
5.修改默认Python版本
- mv /usr/bin/python /usr/bin/python_old
- ln -s /usr/local/bin/python3.5 /usr/bin/python
- ll /usr/bin/python
Mac
1.下载以下软件
- ## Mac OS X 10.5以下下载地址
- https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.5.pkg
- ## Mac OS X 10.5以下下载地址
- https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkg
2.执行python3命令即可查询
- zhaoyulin:~ zhaoyulin$ python3
- Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25)
- [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
- Type "help","copyright", "credits" or "license"for more information.
- >>>