pycharm运行虚拟环境失败的解决方法

pycharm 的terminal 报错virtualenv无法加载文件activate.ps1

遇到问题如下:

无法加载文件 D:\python_script\venv\Scripts\activate.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Ex
ecution_Policies。
    + CategoryInfo          : SecurityError: (:) [],ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess

解决方法:

1、Win+R命令,输入powershell

2、进入终端需要执行 Start-Process powershell -Verb runAs 切换到管理员命令窗口

3、执行 set-ExecutionPolicy RemoteSigned ,执行策略选择 Y

 

posted @ 2022-12-30 13:32  只为。  阅读(1004)  评论(0)    收藏  举报