Search code examples
pythonvisual-studio-codeterminalanacondavirtual-environment

Virtual Environment Not showing up in VS Code Terminal


I was trying to activate a Conda environment from VS Code Terminal. Everything worked but it does not show that it is using the specified Conda Environment. Take a look at my Terminal.Just PS(no venv)

But when I looked at other people's terminal. It is actually showing their environment name in the bracket. Just on a Curious Note, I am asking Why it is so? virtual environment name in bracket


Solution

  • The reason is that "PowerShell" does not activate the conda environment by default.

    Solution: Please use the command

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
    

    in terminal to change the execution policy of "PowerShell", and then open a new VS Code terminal (Ctrl+Shift+`):

    enter image description here

    Check: We can view that the "profile.ps1" file is generated here.

    enter image description here

    Reference: Conda environments in VS Code.