python - 使用 virtualenvwrapper (& virtualenv) 改变默认的 python 版本

标签 python virtualenv virtualenvwrapper

我最近更改了我的 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

关于python - 使用 virtualenvwrapper (& virtualenv) 改变默认的 python 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32489304/

相关文章:

python - 你如何使用 --enable-shared 在虚拟环境中重新编译 python

python-2.x - arch linux 中 virtualenvwrapper.sh 中的 `which python` 搞砸了

python - 如何在Python中存储声音?

python - 使用 open 打印 Python 3 中的特定字段

基于 Python 的密码跟踪器(或字典)

python - 为什么无法从 pip 版本 6.1.1 升级到 8.1.1?

python - 使用 virtualenv 在 debian 中守护 python 脚本

python - "pyenv virtualenvwrapper"是做什么的?

python - mkproject : command not found

python - Python中的嵌套函数调用