Python 2.7 如何在Mac上为python 2.7创建虚拟环境?

Python 2.7 如何在Mac上为python 2.7创建虚拟环境?,python-2.7,virtualenv,Python 2.7,Virtualenv,我在Mac上,想为Python2.7创建一个虚拟环境。我做了以下操作,但不知道如何访问virtualenv来创建环境 (base) congmins-MacBook-Pro:spacy congminmin$ pip --version pip 20.1.1 from /Users/congminmin/anaconda3/lib/python3.8/site-packages/pip (python 3.8) (base) congmins-MacBook-Pro:spacy congmin

我在Mac上,想为Python2.7创建一个虚拟环境。我做了以下操作,但不知道如何访问virtualenv来创建环境

(base) congmins-MacBook-Pro:spacy congminmin$ pip --version
pip 20.1.1 from /Users/congminmin/anaconda3/lib/python3.8/site-packages/pip (python 3.8)

(base) congmins-MacBook-Pro:spacy congminmin$ pip2 --version
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)

(base) congmins-MacBook-Pro:spacy congminmin$ pip2 install virtualenv
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: virtualenv in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (20.0.30)
Requirement already satisfied: filelock<4,>=3.0.0 in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from virtualenv) (3.0.12)
Requirement already satisfied: six<2,>=1.9.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from virtualenv) (1.15.0)
Requirement already satisfied: importlib-metadata<2,>=0.12; python_version < "3.8" in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from virtualenv) (1.7.0)
Requirement already satisfied: appdirs<2,>=1.4.3 in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from virtualenv) (1.4.4)
Requirement already satisfied: importlib-resources>=1.0; python_version < "3.7" in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from virtualenv) (3.0.0)
Requirement already satisfied: distlib<1,>=0.3.1 in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from virtualenv) (0.3.1)
Requirement already satisfied: pathlib2<3,>=2.3.3; python_version < "3.4" and sys_platform != "win32" in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from virtualenv) (2.3.5)
Requirement already satisfied: configparser>=3.5; python_version < "3" in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv) (4.0.2)
Requirement already satisfied: zipp>=0.5 in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv) (1.2.0)
Requirement already satisfied: contextlib2; python_version < "3" in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv) (0.6.0.post1)
Requirement already satisfied: typing; python_version < "3.5" in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from importlib-resources>=1.0; python_version < "3.7"->virtualenv) (3.7.4.3)
Requirement already satisfied: singledispatch; python_version < "3.4" in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from importlib-resources>=1.0; python_version < "3.7"->virtualenv) (3.4.0.3)
Requirement already satisfied: scandir; python_version < "3.5" in /Users/congminmin/Library/Python/2.7/lib/python/site-packages (from pathlib2<3,>=2.3.3; python_version < "3.4" and sys_platform != "win32"->virtualenv) (1.10.0)
WARNING: You are using pip version 19.2.3, however version 20.2.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

(base) congmins-MacBook-Pro:spacy congminmin$ virtualenv spacy27
-bash: virtualenv: command not found
(基本)congmins MacBook Pro:spacy congminmin$pip--版本
PIP20.1.1来自/Users/congminmin/anaconda3/lib/python3.8/site-packages/pip(python 3.8)
(基础)congmins MacBook Pro:spacy congminmin$pip2--版本
pip 19.2.3来自/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip(Python 2.7)
(基础)congmins MacBook Pro:spacy congminmin$pip2安装virtualenv
弃用:Python 2.7将于2020年1月1日结束其使用寿命。请升级您的Python,因为Python 2.7将在该日期后不再维护。pip的未来版本将放弃对Python 2.7的支持。有关pip中Python 2支持的更多详细信息,请访问https://pip.pypa.io/en/latest/development/release-process/#python-2-支持
已满足要求:virtualenv in/Users/congminmin/Library/Python/2.7/lib/Python/site-packages(20.0.30)
已满足要求:filelock=3.0.0 in/Users/congminmin/Library/Python/2.7/lib/Python/site-packages(来自virtualenv)(3.0.12)
已满足要求:六个=1.9.0 in/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages(来自virtualenv)(1.15.0)
已满足要求:importlib元数据=0.12;python_版本=1.0;python_版本=3.5;/Users/congminmin/Library/python/2.7/lib/python/site-packages中的python_版本<“3”(来自importlib metadata=0.12;python_版本<“3.8”->virtualenv)(4.0.2)
已满足要求:zip>=0.5 in/Users/congminmin/Library/Python/2.7/lib/Python/site-packages(来自importlib metadata=0.12;Python_版本<“3.8”->virtualenv)(1.2.0)
已经满足的要求:contextlib2;/Users/congminmin/Library/python/2.7/lib/python/site-packages中的python_版本<“3”(来自importlib metadata=0.12;python_版本<“3.8”->virtualenv)(0.6.0.post1)
已满足的要求:打字;/Users/congminmin/Library/python/2.7/lib/python/site-packages中的python_版本<“3.5”(来自importlib资源>=1.0;python_版本<“3.7”->virtualenv)(3.7.4.3)
已满足的要求:单发;/Users/congminmin/Library/python/2.7/lib/python/site-packages中的python_版本<“3.4”(来自importlib资源>=1.0;python_版本<“3.7”->virtualenv)(3.4.0.3)
已满足的要求:scandir;/Users/congminmin/Library/python/2.7/lib/python/site-packages中的python_版本<“3.5”(来自pathlib2=2.3.3;python_版本<“3.4”和sys_平台!=“win32”->virtualenv)(1.10.0)
警告:您正在使用pip版本19.2.3,但版本20.2.2可用。
您应该考虑通过“PIP安装升级PIP”命令进行升级。
(基础)聪敏MacBook Pro:spacy聪敏$virtualenv spacy27
-bash:virtualenv:未找到命令
如何使“virtualenv”命令可用

编辑:
我不想用蟒蛇。我只想为python2.7创建一个虚拟环境。

你可以使用
python2.7-m virtualenv
或者可能
/Users/congminmin/Library/Python/2.7/bin/virtualenv
@AnthonySottile我工作了,感谢你使用python2.7-m virtualenv,我想这个问题已经在这里得到了回答:@learner420我的问题不同了。我无法运行virtualenv命令:“virtualenv spacy27”