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.
答案 0 :(得分:0)
使用特定的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