VSCode conda activate base giving CommandNotFoundError

后端 未结 4 1435
庸人自扰
庸人自扰 2021-02-09 01:17

I have Anaconda and Visual Studio Code installed on my computer. My default terminal for VS Code is Git Bash. When I open a new terminal in VSCode, it immediately runs the follo

相关标签:
4条回答
  • 2021-02-09 01:35

    I had exactly the same error as you. I solved it with a tip from a Python course in Udacity

    Open Git Bash command line (NOT within VSC terminal) and go to your home folder, e.g., /c/Users/arman. Then run the following two commands but replace [YOUR_PATH] with your Anaconda installation folder

    echo 'export PATH="$PATH:[YOUR_PATH]:[YOUR_PATH]/Scripts"' >> .bashrc
    echo 'alias python="winpty python.exe"' >> .bashrc
    

    For example in my case, as I have miniconda, I executed:

    echo 'export PATH="$PATH:/c/Users/arman/Miniconda3:/c/Users/arman/Miniconda3/Scripts"' >> .bashrc
    echo 'alias python="winpty python.exe"' >> .bashrc
    

    After this executing those lines, i.e., creating the .bashrc file, then run:

    source .bashrc
    

    Afterwards, open VSC and try running or debugging a python program. It worked for me!

    0 讨论(0)
  • 2021-02-09 01:38

    I solved this issue by using Powershell. Start the Powershell as Administrator and then type

    set-ExecutionPolicy RemoteSigned
    

    Say yes if it asks a confirmation. Now, VSCode debugger option can be used with Python.

    0 讨论(0)
  • 2021-02-09 01:51

    I had the same issue. For me, easily resolved by launching VSC from the conda window.

    Specifically, open your cmd prompt (for me, Anaconda Prompt), activate the environment using 'conda activate [envname]'. Then just run the command 'code'. This will launch VS Code with the activated environment and associated variables. From there, the debug works as expected.

    0 讨论(0)
  • 2021-02-09 01:59

    In VS code settings, search for "terminal.integrated.shellArgs.windows", then click "Edit in settings.json". For me, this opened "%APPDATA%\Code\User\settings.json". I set "terminal.integrated.shellArgs.windows": "-i -l" and this fixed it for me. My file:

    {
        "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
        "terminal.integrated.shellArgs.windows": "-i -l"
    }
    
    0 讨论(0)
提交回复
热议问题