Reputation: 199
PS E:\Python and Data Science\PythonDatabase> conda activate base
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ conda activate base
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS E:\Python and Data Science\PythonDatabase> & C:/Users/Lenovo/Anaconda3/python.exe "e:/Python and Data Science/PythonDatabase/CourseHelper.py"
Hello World
PS E:\Python and Data Science\PythonDatabase>
Upvotes: 16
Views: 14044
Reputation: 1230
Building on @Brett Cannon's answer...
You have 2 options. Unless otherwise noted, all of the following assume you are changing VSCode Settings (F1
-> Terminal:Configure Terminal Settings
).
Option 1
Use the Command Prompt instead of PowerShell.
settings.json
file, set the "python.condaPath"
to your conda.exe
. E.g."python.condaPath": "C:\\Users\\<user id>\\Anaconda3\\Scripts\\conda.exe"
Option 2
Set the PATH
variable.
"terminal.integrated.env.windows": {
"PATH": "${env:PATH};C:\\Users\\<user id>\\Anaconda3\\Scripts"
}
conda init
Note that as of the writing of this answer, conda init --help
states that this command is experimental.
MicroSoft states that VSCode doesn't currently support automatically activating Conda environments using PowerShell. However, option 2 seems to work.
Upvotes: 0
Reputation: 16080
You can set "python.terminal.activateEnvironment": false
in your settings to deactivate activation of your environment. Alternatively, you can set "python.condaPath"
to where conda
exists so the extension can use conda appropriately.
Upvotes: 26