我在试着在手机搅拌机里检查。为了进行检查点,我在Canopy中运行了这个py代码:
import random
from math import sqrt
import subprocess
import time
# Set clock
START=time.clock()
# Simulation Parameters - num_real_runs is needed to set the range command in python
num_runs=2
# Counter Variable for total numbers of runs
running=1
while (running<num_runs):
# Execute mcell Part1
subprocess.call("mcell -seed "+str(running)+" change_dc1.mdl", shell=True)
# Execute mcell Part2
subprocess.call("mcell -seed "+str(running)+" change_dc2.mdl", shell=True)
# Calculate elapsed time for executing python script only (in min)
END=time.clock()
ELAPSED=(END-START)
print "Man, it took me only", ELAPSED, "seconds to run the python code!"
running+=1但出于某种原因,它并没有创建一个文件,说程序运行。有什么建议吗?
发布于 2016-11-01 23:08:42
因为Canopy是木星/ IPython QtConsole,它已经运行了2个进程( GUI前端,内核在后台),所以要想弄清楚像您这样正在启动额外进程的程序发生了什么,可能会变得很棘手。我建议在一个更简单的环境中运行它,至少在一开始是这样。在Canopy菜单中,打开Command提示符,通过键入ipython启动一个单进程ipython终端,然后从ipython提示符(In[1])、cd到所需的目录并键入%run myfile.py。
https://stackoverflow.com/questions/40368320
复制相似问题