Mac 环境安装
Mac OS 通常自带 python 2
Mac Os X 系统通常已经安装了 Python 2, 打开 Terminal, 输入 Python,就可以在python的交互解释器时使用 Python 编程了, 如下图。
➜ ~ python
Python 2.7.10 (default, Feb 22 2019, 21:55:15)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print ('hello world')
hello world
>>>
安装 Python 3
不过,现在大部分人会倾向于使用 Python 3,安装 Python 3 也很简单:
-
登录 python官网 下载python3.X.X版本的安装包, 下载完后会有一个python-3.X.X-macosx10.9.pkg;
-
双击python-3.X.X-macosx10.6.pkg文件,打开Python安装向导,如下图:
- 按照安装向导保持默认一步一步完成安装即可。
安装完成之后,电脑上将同时存在 Python3.x 和 Python 2.x 的运行环境,在 Terminal 输入 Python 3,即可启动 Python 3的交互解释器,如下:
➜ ~ python3
Python 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print ('hello world')
hello world
>>>
此外,安装 Python 3 之后,在Mac的程序列表中会多出一个IDLE工具, 一个 Python 3 简易开发环境。
Windows 环境安装
安装方式跟Mac中安装 Python 3 一样,在python官网中下载指定版本的安装包安装即可。