今天在anaconda
下装了pytorch
的虚拟环境后,在cmd
、windows powershell
和anaconda prompt
里可以正常运行conda activate pytorch
但是在vscode
和pycharm
的终端里就报错了(如下),很奇怪。
PS E:\DAT\work\csdn> conda activate pytorch
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- cmd.exe
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
网上方法找了半小时都不行,最后居然试出来了。就是在Windows PowerShell
里面输入下面的指令:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
这时候重启vscode
和pycharm
,在终端里面就可以正常使用conda activate
啦~
猜你喜欢:👇🏻
⭐【Python】不是内部或外部命令,cmd指令报错,path环境配置