# 解决PowerShell中conda activate指令无效的问题 * 问题描述: 在VS Code中,打开终端加载python的虚拟变量是时,发生以下报错: ``` usage: conda-script.py [-h] [--no-plugins] [-V] COMMAND ... conda-script.py: error: argument COMMAND: invalid choice: 'activate' (choose from 'clean', 'compare', 'config', 'create', 'info', 'init', 'install', 'list', 'notices', 'package', 'remove', 'uninstall', 'rename', 'run', 'search', 'update', 'upgrade', 'build', 'convert', 'debug', 'develop', 'doctor', 'index', 'inspect', 'metapackage', 'render', 'skeleton', 'content-trust', 'env', 'repo', 'verify', 'server', 'pack', 'token') ``` 1. 打开PowerShell终端 2. 键入 conda init powershell,初始化conda 3. 键入Set-ExecutionPolicy RemoteSigned,修改PowerShell的限制策略 4. 重启PowerShell,检查conda activate 是否生效。 --- **注意**,如果不执行上述第三步,则会出现如下报错: ``` . : 无法加载文件 C:\Users\gndut\Documents\WindowsPowerShell\profile.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。 所在位置 行:1 字符: 3 + . 'C:\Users\gndut\Documents\WindowsPowerShell\profile.ps1' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [],PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess ``` *请确保执行上述所有命令方可解决。*