Environment Variable Configuration
First you need to configure the path to anaconda into the environment variables, I have both user and system variables configured. My anaconda is installed inD:\Anaconda
, so the environment variable is added:D:\Anaconda
D:\Anaconda\Scripts
D:\Anaconda\Library\bin
These three.
Powershell is not supported
After the environment variables are configured, vscode reports the following error when running the file:
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see /activation
It's a bit annoying...
Open powershell and typeconda activate
, did not reflect...
But open cmd and typeconda activate
Then the base environment is successfully activated, and you can use python in the environment at this point!!!!
So in vscode, just type cmd in terminal and manually activate the environment before opening python. Or just switch the default terminal to cmd, so that every time you run a python file you won't have a problem.
summarize
to this article on Win10 with vscode open anaconda environment python error problem solving article is introduced to this, more related vscode open anaconda environment python error content please search for my previous articles or continue to browse the following related articles I hope that you will support me more in the future!