本文介绍了如何在Windows上创建conda环境快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装Anaconda的情况下,我在Windows startmanu上获得了anaconda base快捷方式.要打开我创建的virtualenv(例如myenv),我必须单击anaconda base,然后在打开的cmd窗口中键入activate myenv.

With Anaconda installed I got a anaconda base shortcut on Windows startmanu. To open the virtualenv I created (e.g., myenv), I have to click the anaconda base and type in activate myenv in the opened cmd window.

如何创建一键式快捷方式,只需单击一下即可到达myenv,而无需像上面那样进行打开和键入操作?

How can I create a shortcut to get to myenv with one-click, without open-and-typing like the above?

我尝试创建基本快捷方式的副本并更改其命令属性,即%windir%\System32\cmd.exe "/K" C:\Programs\anaconda3\Scripts\activate.bat C:\Programs\anaconda3\envs\myenv.它确实打开了myenv cmdline,但是似乎丢失了一些内置命令,例如conda.

I've tried to create a copy of the base shortcut and change its command property i.e., %windir%\System32\cmd.exe "/K" C:\Programs\anaconda3\Scripts\activate.bat C:\Programs\anaconda3\envs\myenv. It does open the myenv cmdline, but seemed lost some buildin command,like conda.

我想我需要有关Windows蝙蝠技巧的一些帮助.

I guess I need a little bit help on Windows bat skills.

推荐答案

在简单的批处理脚本中将上面的注释完美地结合在一起即可:

putting the comments above together in a simple batch script works flawlessly:

@echo off
set PATH=%PATH%;C:\ProgramData\Anaconda3\Scripts
%windir%\system32\cmd.exe "/K" C:\ProgramData\Anaconda3\Scripts\activate.bat <env-name>

这篇关于如何在Windows上创建conda环境快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 22:34