0 Mac 环境python搭建

1、打开终端窗口,输入python

Python 2.7.10 (default, Jul 15 2017, 17:16:57)

[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

提示mac系统版本自带的python版本

退出python方式

1)Ctrl + D

>>> ^D

2)exit()

>>> exit()

2、安装python3 ,官网下载 https://www.python.org/downloads/ 下载最新版本并安装

在终端窗口输入 python3

localhost:~ Leo$ python3

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 03:03:55) 

[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> 

基于系统自带的python2 和 自行安装的python3 ,在之后,所有命令python,用python3替换

3、检验代码,输入 print ("hello python!")

>>> print ("hello python!")

hello python!>>> 

关闭 python 用ctrl+d 或 exit()

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容