pycharm prompt: Unable to load file C:\Users\HUAWEI\Desktop\djangoProject\venv\Scripts\activate.ps1 because running scripts is prohibited on this system

Encountered this problem:

The file C:\Users\HUAWEI\Desktop\djangoProject\venv\Scripts\activate.ps1 cannot be loaded because running scripts is prohibited on this system. About about_Execution_Policies in osoft.co
m/fwlink/?LinkID=135170.

  • CategoryInfo : SecurityError: ( : ) [],ParentContainsErrorRecordException
  • FullyQualifiedErrorId : UnauthorizedAccess

Original origin这り

reason

r e s t r i c t e d restricted restric ted (preventive operation missing number name script), essential configuration r e m o t e s i g n e d remotesigned remotes igned not

Solution

先在 p y c h a r m pycharm pycharm终端输入 g e t − e x e c u t i o n p o l i c y get-executionpolicy getexecut ionpo licyCan I see this limit?

PS XXXXXXXXX> get-executionpolicy
Restricted
PS XXXXX>

Then open as administrator P o w e r s h a l Powershal Powersha ll运行,并下认窗口输入 s e t − e x e c u t i o n p o l i c y   r e m o t e s i g n e d set-executionpolicy\ remotesigned setexecut ionpo licyrem otesig ned Renewal strategy, after that it was brought in Y YY

PS C:\WINDOWS\system32> Set-ExecutionPolicy RemoteSigned

执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170
中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?
[Y](Y)  [A] 全是(A)  [N](N)  [L] 全否(L)  [S] 暂停(S)  [?] 帮助 (默认值为“N”): Y
PS C:\WINDOWS\system32>

Finally p y c h a r m pycharm pycharm终端继续输入 g e t − e x e c u t i o n p o l i c y get-executionpolicy getexecutionpolicy验证。

PS XXXXXXXXX> get-executionpolicy
RemoteSigned
PS XXXXX>

出现 R e m o t e S i g n e d RemoteSigned Remot eSign ed Successful renewal of representative of this character.

Guess you like

Origin blog.csdn.net/weixin_45652283/article/details/131608532