Python 虛擬環境 on Mac

Read Time:16 Second
安裝 Homebrew
~$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安裝 Python 3
~$ brew install python3
*如果沒有Command Line Tools,需要先裝Command Line Tools:
~$ xcode-select —install
安裝 Python 3 的 Virtualenv(虛擬環境)
~$ pip3 install virtualenv
建立虛擬環境
~$ virtualenv [虛擬環境名稱]
例:
~$ virtualenv py3env
進入虛擬環境
~$ source py3env/bin/activate
離開虛擬環境
~$ deactivate