使用 virtualenvwrapper (& virtualenv) 更改默认 python 版本

change default python version with virtualenvwrapper (& virtualenv)

我最近更改了我的 python 设置,现在它已与 brew 一起安装。以前在使用 virtualenv 和 virtualenvwrapper 时,它会默认使用 python3(用于我的大部分项目)设置一个新的 virtualenv。不幸的是,现在默认是 python2。我可以安装 python3 使用:

mkproject -p python3 projectname

但是我怎样才能使 python3 成为默认值?

To automatically use a custom Python binary instead of the one virtualenv is run with you can also set an environment variable:

$ export VIRTUALENV_PYTHON=/opt/python-3.3/bin/python
$ virtualenv ENV

It’s the same as passing the option to virtualenv directly:

$ virtualenv --python=/opt/python-3.3/bin/python ENV

来源:https://virtualenv.pypa.io/en/latest/reference.html#configuration