一:前言

mac上自带了python2.7,但是由于版本过于老旧很多功能都已不再支持,所以要安装Python3


二:安装步骤

———下载并安装Python3:
Python官网:https://www.python.org/downloads/mac-osx/

 


——配置环境变量

//使用命令open .bash_profile打开配置文件
open .bash_profile或open -e .bash_profile

//在配置文件末尾添加路径
alias python="/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7"

//编译系统配置文件
source ~/.bash_profile

Python位置:Macintosh HD—资源库—Frameworks—Python.framework—Versions—指定版本


三:常用命令

——查看Python版本:python --version
——查看安装位置:which python3
——列出已安装的包:pip list