阅读本文大约需要 5 分钟
Windows
打开 Python 官方下载网站
x86: 表示是 32 位电脑
x86-64: 表示是 64 位电脑
目前 Python 版本分为 2.x 版本和 3.x 版本. 推荐大家使用 3.x 版本.
我的电脑 -> 属性 -> 高级系统设置 -> 环境变量
配置
在 "变量值" 一栏, 把自己所安装的 python 路径拷进去就可以了, 例: C:\Python37
注意
在拷贝路径 C:\Python37 时, 前面要加分号, 还要注意, 分号一定是英文输入法里的分号.
测试
打开 cmd 可以输入 Python 运行了. 如果说 python 不是有效的命令, 那可能需要检查一下上面的步骤了
Mac
Mac 平台一般都会自带 Python2.x 版本, 如果想安装 Python3.x 版本. 最好用 HomeBrew 安装.
安装 HomeBrew
/usr/bin/Ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
测试
brew doctor
安装 Python
brew install python
查看
- // 系统自带的 python2.7, 目录为 / usr/bin/python
- which python
- //brew 安装的 python3.6, 目录为 / usr/local/bin/python3
- which python3
- Unix/Linux
Unix/Linux 一般都会自带两个版本, 可以在终端输入 python 和 python3 进行查看自带的版本.
来源: http://www.jianshu.com/p/e9b94c71dada