尝试 运行 Enthought canopy 中的 .py 文件 windows 8
Trying to run .py files in Enthought canopy in windows 8
我正在尝试在细胞搅拌器中设置检查点。为了检查点,我是 运行 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
但出于某种原因,它没有创建一个文件说明程序 运行。有什么建议吗?
因为CanopyPython是Jupyter/IPythonQtConsole,已经是运行2个进程(前端在GUI,内核在后台),可以得到很难弄清楚像您这样的程序正在启动其他进程时发生了什么。我会推荐 运行 它,至少最初是在一个更简单的环境中。从 Canopy 工具菜单,打开 Canopy 命令提示符,通过键入 ipython
启动单进程 ipython 终端,然后从 ipython 提示符(In[1]
),cd
到所需的目录并键入 %run myfile.py
.
我正在尝试在细胞搅拌器中设置检查点。为了检查点,我是 运行 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
但出于某种原因,它没有创建一个文件说明程序 运行。有什么建议吗?
因为CanopyPython是Jupyter/IPythonQtConsole,已经是运行2个进程(前端在GUI,内核在后台),可以得到很难弄清楚像您这样的程序正在启动其他进程时发生了什么。我会推荐 运行 它,至少最初是在一个更简单的环境中。从 Canopy 工具菜单,打开 Canopy 命令提示符,通过键入 ipython
启动单进程 ipython 终端,然后从 ipython 提示符(In[1]
),cd
到所需的目录并键入 %run myfile.py
.