我如何在conda env中启动exe [英] How can I launch an exe within a conda env

查看:265
本文介绍了我如何在conda env中启动exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows 10中使用vscode作为我的代码编辑器,并希望提供一种使用正确的conda env来启动它以进行调试的简便方法.

I'm using vscode in Windows 10 as my code editor, and want to make an easy way to launch it with the correct conda env to allow debugging.

当前,我必须打开命令提示符,然后激活conda env,然后将vscode的快捷方式粘贴到提示符下才能执行.像这样:

Currently I am having to open a command prompt, then activate the conda env, then paste the shortcut to vscode into the prompt to execute. Like so:

cmd
activate env-name
"C:\Program Files (x86)\Microsoft VS Code\Code.exe"

我曾尝试创建一个批处理文件来包装这些调用,但是不幸的是,一旦我调用源激活"来启动conda env,此后的批处理命令就不会执行,因为它被视为另一个实例.

I have tried creating a batch file to wrap these calls, but unfortunately once I call "source activate" to start the conda env, the batch commands after this are not executed as it is considered another instance.

有什么秘诀吗?除了编写一个vscode扩展来解决这个问题(我很想这样做,但这是一个简单的问题...)

Any tips? Other than writing a vscode extension to handle this (which I'm seriously tempted to do, but it's such a simple problem...)

推荐答案

您可能希望将source activate env-name作为任务在Visual Studio中运行. https://code.visualstudio.com/Docs/editor/tasks

You might want to run source activate env-name as a task in visual studio. https://code.visualstudio.com/Docs/editor/tasks

{
    "version": "0.1.0",
    "command": "cmd",
    "isShellCommand": true,
    "suppressTaskName": true,
    "args": [],
    "tasks": [
        {
            "taskName": "development",
            "args": ["source", "activate", "env-name"]
        }
    ]
}

这篇关于我如何在conda env中启动exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆