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>
3341 次
2 回答
11
您可以"python.terminal.activateEnvironment": false在设置中设置停用您的环境的激活。或者,您可以设置"python.condaPath"为存在的位置conda,以便扩展可以适当地使用 conda。
于 2020-04-01T22:59:45.420 回答
0
基于@ Brett Cannon的回答...
您有 2 个选项。除非另有说明,否则以下所有内容均假定您正在更改 VSCode 设置 ( F1-> Terminal:Configure Terminal Settings)。
选项1
使用命令提示符而不是 PowerShell。
"python.condaPath": "C:\\Users\\<user id>\\Anaconda3\\Scripts\\conda.exe"
选项 2
设置PATH变量。
- 将 conda.exe 的路径添加到 PATH 环境变量中(根据https://stackoverflow.com/a/66259191/11262633):
"terminal.integrated.env.windows": {
"PATH": "${env:PATH};C:\\Users\\<user id>\\Anaconda3\\Scripts"
}
- 启动 PowerShell 终端。您将收到一条消息,指出 Conda 尚未初始化。运行以下命令:
conda init
请注意,在撰写此答案时,conda init --help声明此命令是实验性的。
微软表示VSCode 目前不支持使用 PowerShell 自动激活 Conda 环境。但是,选项 2 似乎有效。
于 2021-06-26T11:53:06.810 回答
