无法在 Powershell 上激活 Virtualenv
Can't Activate Virtualenv on Powershell
我正在努力学习 Django。
首先,我需要安装 Python、Django 和 Virtualenv。这些都安装没有错误。但是现在我要启动一个项目,运行virtualenv,在powershell里面激活不了
我用这个命令制作了一个虚拟环境:
python -m virtualenv venv
现在教程说我必须像这样激活 virtualenv:
. \scripts\activate
但它给了我这个错误:
. : The term '\scripts\activate' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:3
+ . \scripts\activate
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\scripts\activate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我该怎么办?
我试过了scripts\activate.ps1
,但还是不行。
您应该使用 scripts\activate.ps1
而不是 scripts\activate
。查找更多信息 here
它与 cmd 完美兼容,但与 Powershell 不兼容。
我正在努力学习 Django。 首先,我需要安装 Python、Django 和 Virtualenv。这些都安装没有错误。但是现在我要启动一个项目,运行virtualenv,在powershell里面激活不了
我用这个命令制作了一个虚拟环境:
python -m virtualenv venv
现在教程说我必须像这样激活 virtualenv:
. \scripts\activate
但它给了我这个错误:
. : The term '\scripts\activate' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:3
+ . \scripts\activate
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\scripts\activate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我该怎么办?
我试过了scripts\activate.ps1
,但还是不行。
您应该使用 scripts\activate.ps1
而不是 scripts\activate
。查找更多信息 here
它与 cmd 完美兼容,但与 Powershell 不兼容。