Mac同時安裝python2和python3
Mac自帶的python版本2.7,而2.7的版本默認的字符集是ascii,不支持中文,3的版本默認是utf-8,在使用中會方便很多
安裝套件管理工具homebrew:
localhost:~ mac$ ruby -e "$(curl -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"
安裝後檢查一下(我的雖然安裝後出現waring提示,但是不影響python3的安裝的):
localhost:~ mac$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: A newer Command Line Tools release is available.
Update them from Software Update in the App Store.
Warning: Broken symlinks were found. Remove them with `brew prune`:
/usr/local/share/man/man8/prlexec.8
安裝python3:
localhost:~ mac$ brew install python3
檢查python版本:
localhost:~ mac$ python3 –v
Python 3.7.0 (default, Oct 2 2018, 09:20:07)
檢查連個python位置:
localhost:python mac$ which python
/usr/bin/python
localhost:python mac$ which python3
/usr/local/bin/python3