2017-10-16T16:33:53Z||2017-10-16T16:33:53Z
macOS默认是Python 2.7。所以需要先安装Python 3.
brew install python3
安装完毕后可以用过python3 -V
来验证。
然后安装virtualenv:
pip install virtualenv
完毕后。创建一个基于Python 3的虚拟目录:
virtualenv -p python3 app
激活目录:
source bin/activate
输出:
Python 3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
OK了!