试图在Windows 8中的Enthought冠层中运行.py文件

时间:2016-11-01 20:42:28

标签: python canopy

我正在尝试在细胞混合器中检查点。为了检查点我在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

但由于某种原因,它不会创建一个文件说程序运行。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

因为Canopy Python是Jupyter / IPython QtConsole,它已经运行了2个进程(GUI中的前端,后台的内核),所以尝试用你的程序来计算正在发生的事情会很棘手。启动其他流程。我建议至少在最初的环境中运行它。从Canopy工具菜单中,打开Canopy命令提示符,通过键入var cache = struct { sync.Mutex mapping map[string]string } { mapping: make(map[string]string), } 启动单进程ipython终端,然后从ipython提示符(ipython),In[1]启动到所需目录,输入cd