(20200404已解决)conda activeate错误The above line should NO LONGER be in your ~/.bashrc file!

  • 问题描述

    VSCode中运行python文件,出现如下错误。

    PS F:\savedata> conda activate base
    
    CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.     
    If your shell is Bash or a Bourne variant, enable conda for the current user with
    ...
    
    ^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
    
  • 解决方案

    原因是无法在powershell中自动激活conda环境。

    参考1给了两种方案,逻辑肯定是对的,但实测对我当下无效。后来发现,当修改lauch.json后单重启VSCode是不行的,重启电脑后可以了。

    1. 修改默认终端

      lauch.json文件中:

      "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
      
    2. 取消自动激活

      lauch.json文件中:

      "python.terminal.activateEnvironment": false
      
    3. 手动修改终端

      可以在terminal的选择窗口中更改Shell

      Select dedault shell --> Command Prompt

  • References

  1. vscode conda activate CommandNotFoundError
  2. ‘conda activate conda-environment’ not working on Windows 10 #5541

你可能感兴趣的:(Error,Record,#,小白学Python)