Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 如何在VisualStudio代码终端调用中使用/K?_Python 3.x_Visual Studio Code_Anaconda_Conda - Fatal编程技术网

Python 3.x 如何在VisualStudio代码终端调用中使用/K?

Python 3.x 如何在VisualStudio代码终端调用中使用/K?,python-3.x,visual-studio-code,anaconda,conda,Python 3.x,Visual Studio Code,Anaconda,Conda,如何在终端中运行python代码时使用“/K”命令从visual studio进行终端调用 %windir%\System32\cmd.exe“/K”C:\Users\shuvagho\Anaconda3\Scripts\activate.bat C:\Users\shuvagho\Anaconda3您可以在设置.json中使用shellArgs参数,如下所示: "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.ex

如何在终端中运行python代码时使用“/K”命令从visual studio进行终端调用


%windir%\System32\cmd.exe“/K”C:\Users\shuvagho\Anaconda3\Scripts\activate.bat C:\Users\shuvagho\Anaconda3

您可以在设置.json中使用shellArgs参数,如下所示:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/K", "conda activate"],

"python.terminal.activateEnvironment": false,
如果通过“conda init”正确初始化了Anaconda,则您的系统路径上应该有“.\Anaconda3\condabin”,并且conda.bat将在没有进一步规范的情况下找到

最后一个参数禁用自动激活,因为现在在每次终端启动时都会直接执行此操作