如何使批处理文件在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屋!