0
点赞
收藏
分享

微信扫一扫

python如何调用MrBayes.exe

凯约 2022-03-12 阅读 63

用os.popen()可以实现

完整代码:

import os

def run_MrBayes():
    my_exe_path = r'D:\MrBayes-3.2.7-WIN\bin\mb.3.2.7-win64.exe'
    my_txt_path = r"D:\MrBayes-3.2.7-WIN\bin\test.nex"
    cmd = my_exe_path + " " + my_txt_path
    os.popen(cmd)

run_MrBayes()

注意:
运行MrBayes.exe还需要输入参数,例如:
mcmcp savebrlens=yes ngen=100000 samplefreq=1000 nchains=4;
mcmc;
把他们写在 txt 文件里!!
这里把他们写入我的 test.nex 文件
在这里插入图片描述
保存后,运行代码即可,结果如下:
在这里插入图片描述
完。。。
血泪教训:卡了我一天的地方就是没有把参数命令写在test.nex文件里,还疑惑调了exe之后再怎么输入命令。。

举报

相关推荐

0 条评论