How do I get PowerShell working in VS Code again after setting up Anaconda?

November 14, 2026 5 answers
Asked by Renvick.63

After selecting an Anaconda Python interpreter in VS Code, PowerShell started reporting that profile scripts are disabled and Conda activation fails. I switched the terminal to Command Prompt, but now my C++ run and debug setup also reports a pre-launch task failure.

Should I reinstall everything, or is there a way to isolate what broke?

Answers

Pindor.6x

I wouldn't reinstall MinGW yet. First open PowerShell outside VS Code and run Get-ExecutionPolicy -List. That shows the policies at each scope, so you can see whether a machine policy or a user setting is blocking scripts.

If the error names profile.ps1, check its contents before changing anything. Conda initialization may have added activation commands there. You can start PowerShell with powershell -NoProfile to test whether the profile is involved. Don't just set the execution policy to Unrestricted to make the warning disappear.

6c~looseleaf_91:

If a policy is enforced by an organization, changing a user setting may not override it. The scope list should help make that visible.

Reply to this answer
kestrelly

Separate the Python and C++ projects into different VS Code workspaces. Interpreter selection and extension settings can be scoped to a workspace, which makes it easier to keep Conda setup out of the C++ project.

For troubleshooting, disable extensions you don't need in the C++ workspace, then open a fresh terminal. That won't necessarily fix a broken build task, but it can help narrow down what's triggering the activation attempt.

Reply to this answer
2q~gasket_641

The pre-launch task error is a separate clue. Open the terminal output for that task and look for the actual compiler command and error, rather than relying on exit code -1 alone. Check the workspace's tasks.json and launch.json if you have them, especially the compiler path and the name of the pre-launch task.

Also try compiling a tiny C++ program from a terminal and running the resulting executable directly. That helps distinguish a compiler or PATH problem from a VS Code task or run configuration problem. A program that uses cin needs input in an interactive terminal, not just an output pane.

Reply to this answer
a302+parcel_7

Reinstalling VS Code doesn't necessarily reset your settings or extensions. If you want to test a clean configuration, back up or rename the user data and extension folders rather than deleting them. On Windows, check %APPDATA%\Code and %USERPROFILE%\.vscode.

Keep the backup until you know what you need from it. Workspace settings and build files can also affect a project, so a clean user profile alone may not fix the run task.

Reply to this answer
r407+telex_62

Conda isn't required for every Python project. A standard Python installation and a virtual environment are another option, but python -m venv needs a working Python command first. If Windows says Python wasn't found, check which interpreter is installed and available on PATH before trying to create the environment.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions