我需要根据操作系统执行二进制文件。
我的机器是带有Ubuntu子系统的Windows 10系统。
当我尝试使用process.platform
获取操作系统时,我的控制台告诉我我正在使用Linux。
我有Windows和Linux的二进制文件,如果当前的机器是Windows,我想运行我的.exe,但是当process.plattform
返回Linux时,如何获得操作系统?
答案 0 :(得分:1)
有一个模块,它提供了许多特定于操作系统的实用方法。
在Windows 10中,我的代码是:
def build_graph():
[stuffs]
return operations_to_run
operations = []
for graph_no in range(NGRAPHS):
operations.append(build_graph)
with tf.Session() as sess:
sess.run(operations)
答案 1 :(得分:0)
这是我的解决方案:
let OS = os.release();
if(OS.indexOf("Microsoft")>=0){
bin = bin.concat(".exe");
}
谢谢javatar。