如何使批处理文件在 anaconda 提示符下运行 [英] How to make batch files run in anaconda prompt
问题描述
在 windows 中安装 anaconda3 后,我可以从 anaconda 提示符运行 python 命令,但不能从 windows 命令提示符运行.我想制作一个桌面快捷方式来激活我的环境并从中运行 spyder.以前,我会使用 .bat
文件执行此操作,但现在我无法从 cmd.exe
运行 python 命令,这不起作用.
After installing anaconda3 in windows, I can run python commands from the anaconda prompt, but not from the windows command prompt.
I would like to make a desktop shortcut to activate my environment and run spyder from it. Previously, I would do this with a .bat
file, but now that I cannot run python commands from cmd.exe
this doesn't work.
是否有其他方法可以为 anaconda 提示符运行批处理文件?我知道我可以修改我的 PATH
来让 cmd.exe
运行 python 命令,但我想尽可能避免这种情况.
Is there an alternative way of running batch files for the anaconda prompt?
I know that I could just modify my PATH
to get cmd.exe
to run python commands, but I'd like to avoid this if possible.
推荐答案
我相信 Anaconda 提示符所做的一切就是打开 CMD 并运行批处理文件.执行脚本的第一个命令:
I believe all the Anaconda prompt does is open CMD and run a batch file. Make the first command of your script:
call <anaconda_dir>/Scripts/activate.bat <anaconda_dir>
这篇关于如何使批处理文件在 anaconda 提示符下运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!