在Windows 10 PowerShell中激活虚拟环境时出错

ua4mk5z4  于 2022-12-29  发布在  Shell
关注(0)|答案(1)|浏览(278)

在Windows 10 PowerShell中激活虚拟环境时出现错误:

PS C:\Users\sunil\Desktop\my_projects> .\venv\Scripts\activate.ps1
.\venv\Scripts\activate.ps1 : The term '.\venv\Scripts\activate.ps1' 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.

即使这样尝试:

PS C:\Users\sunil\Desktop\my_projects\venv> .\Scripts\activate
Program 'activate' failed to run: No application is associated with the
specified file for this operationAt line:1 char:1
    + .\Scripts\activate
    + ~~~~~~~~~~~~~~~~~~.
watbbzwu

watbbzwu1#

如果您运行的是Windows,则导航到<venv>\Scripts,其中<venv>是虚拟环境的名称。然后,执行以下命令:

set-Executionpolicy -Executionpolicy Remotesigned -Scope CurrentUser

键入activate并按回车键,您现在就可以使用虚拟环境了。

相关问题