且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

'virtualenv' 不会在 Windows 上激活

更新时间:2021-09-04 08:29:34

根据微软技术支持它可能是执行策略设置的问题.要修复它,您应该尝试在 PowerShell 窗口中执行 Set-ExecutionPolicy Unrestricted -Scope Process(如@wtsiamruk 的评论部分所述).这将允许在当前 PowerShell 会话中运行 virtualenv.

According to Microsoft Tech Support it might be a problem with Execution Policy Settings. To fix it, you should try executing Set-ExecutionPolicy Unrestricted -Scope Process (as mentioned in the comment section by @wtsiamruk) in your PowerShell window. This would allow running virtualenv in the current PowerShell session.

还有另一种更不安全的方法,但 MS 技术支持推荐.这种方法是使用 Set-ExecutionPolicy Unrestricted -Force(它会释放力量来搞砸你的系统).但是,在您使用这种不安全的方式之前,请务必使用 get-ExecutionPolicy 检查您当前的 ExecutionPolicy 设置.然后,当你完成后,你可以使用 Set-ExecutionPolicy %get-ExecutionPolicy 命令给你的值% -Force 来恢复到这个 ExecutionPolicy.

There is also another approach that is more unsafe, but recommended by MS Tech Support. This approach would be to use Set-ExecutionPolicy Unrestricted -Force (which do unleash powers to screw Your system up). However, before you use this unsafe way, be sure to check what your current ExecutionPolicy setting is by using get-ExecutionPolicy. Then, when you are done, you can revert back to this ExecutionPolicy by using Set-ExecutionPolicy %the value the get-ExecutionPolicy command gave you% -Force.