Python 2 和 Python 3 与虚拟环境混合错误?

Python 2 and Python 3 mixing error with virtual environments?

1) 我使用安装程序在 windows 上安装了 python3.5。我检查了设置路径。

2) 我使用安装程序在 windows 上安装了 python2.7。我检查了设置路径。

3) 我打开命令提示符

>>> python -m venv tutorial-env
C:\Python27\python.exe: No module named venv

好吧....那怎么样...

>>>py -3
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit      
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

>>>python -m venv tutorial-env
>File "<stdin>", line 1
python -m venv tutorial-env
             ^
SyntaxError: invalid syntax

好的。我关闭了我的命令提示符并开始了一个新的命令提示符。文件说要用这个...但是...

>>>>python3 -m venv tutorial-env
'python3' is not recognized as an internal or external command,
operable program or batch file.

我指的文档 https://docs.python.org/3/tutorial/venv.html

要使用特定的 python 你可以这样做:

python3 -m venv tutorial-env #for python 3
python2 -m venv tutorial-env #for python 2
#if you have multple versions of 3 or 2
python2.7 -m venv tutorial-env #for python 2.7
python3.5 -m venv tutorial-env #for python 3.5 or something along the lines

编辑

如果在 Windows 中并且上述方法不起作用:

#In command prompt
py -3 #or -2
>>> import venv
>>> venv.main('tutorial-env')

py -3 -m venv tutorial-env