通过Homebrew与python2和python3一起使用virtualenv [英] virtualenv with python2 and python3 via Homebrew
问题描述
我已经用Homebrew安装了python2和python3.我想使用virtualenv,但不确定是否需要为python2/python3安装它.我也想知道是否可以使用virtualenvwrapper来根据自己的需要将VIRTUALENVWRAPPER_PYTHON设置为python2或python3?
I have installed python2 and python3 with Homebrew. I would like to use virtualenv but I am not sure if I need to install it for both python2/python3. I am also wondering if I use virtualenvwrapper can I just set the VIRTUALENVWRAPPER_PYTHON to be either python2 or python3 depending on my needs?
任何帮助将不胜感激.
Any help is greatly appreciated.
谢谢, 格雷格
推荐答案
根据此问题,对于两个版本,您都可以使用单个virtualenv
,只需使用-p path/to/python/version
或--python=path/to/version
标志来指定用于创建虚拟环境的版本.请注意,您可以对mkvirtualenv
使用相同的标志.
According to this SO question, you could use a single virtualenv
for both version, just use the -p path/to/python/version
or --python=path/to/version
flag to specify which version to use for the creation of the virtual environment. Note that you can use the same flag with mkvirtualenv
.
此帖子建议仅使用系统Python(在您的情况下为2.7)自行安装virtualenv
.
This post recommends to just use the system Python (2.7 in your case) to install virtualenv
itself.
这篇关于通过Homebrew与python2和python3一起使用virtualenv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!