Using Python 3 in Virtualenv
Mac has native python installed with version 2.7. However, we sometimes want to use python 3. The following are easy steps to run python 3 along the system default version 2.7.
Step 1: Install brew if not yet done.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step 2: Install pyenv and python 3.6.0.
brew install pyenv
pyenv install 3.6.0
virtualenv -p /Users/yangfeng/.pyenv/versions/3.6.0/bin/python3.6 myenv
. ./myenv/bin/activate && python -V