我可以从bat文件中运行anaconda吗?

时间:2017-09-24 01:44:45

标签: python batch-file

我刚刚将我的python安装更新为Anaconda 4.4.0

问题是我现在无法从.bat文件运行我的python脚本。

我正在使用tensorflow进行开发,因此我专门为它设置了一个python 3.5环境。以前我可以使用行

在.bat文件中访问该环境
call activate tensorflow

现在出现错误

'activate' is not recognized as an internal or external command,
operable program or batch file.

理想情况下,我想继续使用.bat文件,以便我可以通过双击运行我的训练程序,而不必每次都输入相同的命令。

有没有人知道如何在Anaconda Prompt中运行.bat,或者在没有'activate'关键字的情况下从cmd访问python环境?

1 个答案:

答案 0 :(得分:0)

Activate不是标准的Windows命令,因此会抛出错误。

我猜你的意思是把这两个词当成一个命令。如果是这样,请引用它们:

call "activate tensorflow"

以下是命令处理器如何看待两种引用方法的比较:

>call activate tensorflow
  (run the program "activate" with the parameter "tensorflow")

>call "activate tensorflow"
  (run the program "activate tensorflow" with no parameters)

最后,call命令用于调用脚本/子例程,但保留原样不会做任何额外的事情。