简体   繁体   English

如何使用子进程运行命令模块?

[英]How to run command module avail using subprocess?

I want to call module avail and module laod during my python code using subprocess.call which is something like this. 我想使用subprocess.call在我的python代码中调用模块有效和模块laod,这是这样的。

    subprocess.call(['module avail calibre','&','module load calibre'])

But when I run this code it returns: 但是,当我运行此代码时,它将返回:

OSERROR (2, 'No such file or directory') OSERROR(2,“没有此类文件或目录”)

Any help regarding subprocess?? 任何有关子流程的帮助?

If you are trying to run this shell command: 如果您尝试运行此shell命令:

$ module avail calibre & module load calibre

with subprocess try: 与子流程尝试:

subprocess.call(['module','avail','calibre','&','module','load','calibre'])

or: 要么:

subprocess.call('module avail calibre & module load calibre',shell=True)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM