终端安装python,尝试安装python3,但终端始终显示为python 2.7.13

I have 2.7.13 on macOS Sierra and I'm trying to upgrade to python3 via

brew install python3

everything seems to have went fine except the last part:

==> 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

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

after that I type

python

and I get

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.

I'm pretty new to coding so any help is appreciated!

解决方案

Python 2.x and Python 3.x have different terminal commands.

Use command : python3 to use python 3.x

Similarly, use pip3 for installing python modules.

Note : Also try to learn virtualenv (virtual environments), so that you can keep your python 2.x and python 3.x environments separate.

There are many tutorials to do this, one such is this tutorial.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值