powershell无法安装模块的解决方法
·
微软PowerShell无法安装模块,提示:Install-Module : 在模块“PowerShellGet”中找到“Install-Module”命令,但无法加载该模块。有关详细信息,请运行“Import-Module PowerShellGet”。
当运行Import-Module PowerShellGet后:显示:
Import-Module : 无法加载文件 C:\Users\xxx\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.7\PackageManagement.psm1,因为在此系统上禁止运行脚本
。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ Import-Module PowerShellGet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [Import-Module],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand
原因:
在计算机上启动 Windows PowerShell 时,执行策略很可能是 Restricted(默认设置)。
powershell 输入:get-executionpolicy

显示为: Restricted
解决方法:
修改执行策略:
输入: set-executionpolicy remotesigned

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)