繁体   English   中英

为什么我得到 - 无法加载文件,因为在此系统上禁用了运行脚本

[英]why i am getting - file cannot be loaded because running scripts is disabled on this system

在 pycharm 中加载 python 文件时,我收到以下警告,之前它没有print('Hello')按预期工作,但我无法安装 django。

File C:\Users\abhi\PycharmProjects\django_apps\venv\Scripts\activate.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see 
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
    + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess

试着检查一下,它可能会有所帮助。

以下是如何使运行 PowerShell 脚本成为可能:

打开您当前使用的 Windows PowerShell 或 IDE 的管理员级终端。 输入Get-ExecutionPolicy 它显示了当前 PowerShell session 的策略。 您还可以输入Get-ExecutionPolicy -List以列出所有范围的策略。 get-execution-policy 更改您想要的 scope 的执行策略。 为此,您需要的命令是: Set-ExecutionPolic y -ExecutionPolicy <policy name> -Scope <scope> 一般来说,我们建议使用Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned ,因为它更安全。 set-execution-policy 如果不能解决问题,输入: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

关联

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM