简体   繁体   English

virtualenv与python2和python3通过Homebrew

[英]virtualenv with python2 and python3 via Homebrew

I have installed python2 and python3 with Homebrew. 我已经用Homebrew安装了python2和python3。 I would like to use virtualenv but I am not sure if I need to install it for both python2/python3. 我想使用virtualenv,但我不确定是否需要为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? 我也想知道我是否使用virtualenvwrapper我可以根据我的需要将VIRTUALENVWRAPPER_PYTHON设置为python2或python3吗?

Any help is greatly appreciated. 任何帮助是极大的赞赏。

Thanks, Greg 谢谢,格雷格

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. 根据这个问题 ,您可以对两个版本使用单个virtualenv ,只需使用-p path/to/python/version--python=path/to/version标志来指定用于创建的版本。虚拟环境。 Note that you can use the same flag with mkvirtualenv . 请注意,您可以使用与mkvirtualenv相同的标志。

This post recommends to just use the system Python (2.7 in your case) to install virtualenv itself. 这篇文章建议只使用系统Python(在你的情况下为2.7)来安装virtualenv本身。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM