gpt4 book ai didi

Python:从 jupyter notebook 执行终端命令

转载 作者:太空宇宙 更新时间:2023-11-04 08:27:58 26 4
gpt4 key购买 nike

我想从 jupyter notebook 运行 C++ 模拟。该程序需要输入三个值,即 100.20.6

这是我现在正在做的并且工作正常:

## Compile
! mpicxx -o main main.cpp Node.cpp Agent.cpp -std=gnu++11
## Run
! mpirun -np 1 ./main 10 0.2 0.6

但是如果之前尝试声明这些值,它不会识别它们。

a = 10
b = 0.2
c = 0.6
! mpirun -np 1 ./main a b c

最佳答案

你需要这样输入

a = 10
b = 0.2
c = 0.6
! mpirun -np 1 ./main {a} {b} {c}

关于Python:从 jupyter notebook 执行终端命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55416796/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com