使用维塔列夫,我使用默认版本的Python (2.7)运行我的项目。在一个项目中,我需要使用Python3.4。
我用brew install python3把它安装在我的Mac上。现在,我如何创建一个使用新版本的虚拟环境?
例如sudo virtualenv envPython3
如果我试着:
virtualenv -p python3 test我得到:
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python3/3.4.0_1/Frameworks/Python.framework/Versions/3.4'
New python executable in test/bin/python3.4
Also creating executable in test/bin/python
Failed to import the site module
Traceback (most recent call last):
File "/Users/user/Documents/workspace/test/test/bin/../lib/python3.4/site.py", line 67, in <module>
import os
File "/Users/user/Documents/workspace/test/test/bin/../lib/python3.4/os.py", line 634, in <module>
from _collections_abc import MutableMapping
ImportError: No module named '_collections_abc'
ERROR: The executable test/bin/python3.4 is not functioning
ERROR: It thinks sys.prefix is '/Users/user/Documents/workspace/test' (should be '/Users/user/Documents/workspace/test/test')
ERROR: virtualenv is not compatible with this system or executable发布于 2014-05-24 08:11:01
简单地跑
virtualenv -p python3 envname在OP编辑后更新:
正如这里所描述的,OP的virtualenv版本中有一个bug。通过运行以下方法解决了这个问题:
pip install --upgrade virtualenv发布于 2015-05-14 09:09:36
发布于 2015-09-19 20:38:09
https://stackoverflow.com/questions/23842713
复制相似问题