Python3之Mac安装Python

Mac安装Python及查看Python版本

Mac OS已经自带了Python,查看Python版本,在Mac终端输入
python -V 就可以查看版本,Mac自带python版本是2.7.10

Python3之Mac安装Python_第1张图片

我们也可以安装最新版本的python
方法一:python官网https://www.python.org/
方法二:如果安装了HomeBrew,直接使用命令行brew install python3

可以通过python3 -V,查看最新安装的版本

Python3之Mac安装Python_第2张图片

Python之Hello World

打开终端,运行命令行

python3

返回

Python 3.6.3 (v3.6.3:2c5fed86e0, Oct  3 2017, 00:32:08) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

输出Hello World

 print('Hello World')

输出:

Hello World

退出Python交互环境

exit()

Python3之Mac安装Python_第3张图片

你可能感兴趣的:(Python学习)