试图安装python3但终端一直显示为python 2.7.13

shb*_*oms 2 python homebrew

我在macOS Sierra上有2.7.13,我正在尝试升级到python3 via

brew install python3
Run Code Online (Sandbox Code Playgroud)

除了最后一部分,一切似乎都很顺利:

==> Installing python3 
==> Downloading https://homebrew.bintray.com/bottles/python3-3.6.1.sierra.bottle
######################################################################## 100.0%
==> Pouring python3-3.6.1.sierra.bottle.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/python3/3.6.1/bin/python3 -s setup.py --no-user-cfg instal
==> /usr/local/Cellar/python3/3.6.1/bin/python3 -s setup.py --no-user-cfg instal
==> /usr/local/Cellar/python3/3.6.1/bin/python3 -s setup.py --no-user-cfg instal
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>

They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: http://docs.brew.sh/Homebrew-and-Python.html
==> Summary
  /usr/local/Cellar/python3/3.6.1: 3,600 files, 55.8MB
Run Code Online (Sandbox Code Playgroud)

之后我输入

python
Run Code Online (Sandbox Code Playgroud)

我明白了

Python 2.7.13 (default, Dec 17 2016, 23:03:43) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Run Code Online (Sandbox Code Playgroud)

我对编码很新,所以任何帮助都表示赞赏!

Sat*_*arg 5

Python 2.x和Python 3.x有不同的终端命令.

使用命令:python3使用python 3.x.

同样,pip3用于安装python模块.


注意:还尝试学习virtualenv(虚拟环境),以便您可以将python 2.x和python 3.x环境分开.

有很多教程可以做到这一点,其中一个就是本教程.