【问题标题】:Trying to run .py files in Enthought canopy in windows 8尝试在 Windows 8 的 Enthought 机盖中运行 .py 文件
【发布时间】:2016-11-01 20:42:27
【问题描述】:

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

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

【问题讨论】:

标签: python canopy


【解决方案1】:

因为 Canopy Python 是 Jupyter / IPython QtConsole,它已经在运行 2 个进程(GUI 中的前端,后台中的内核),试图弄清楚像您这样的程序发生了什么可能会变得很棘手启动额外的进程。我建议至少在开始时在更简单的环境中运行它。从 Canopy 工具菜单中,打开 Canopy 命令提示符,通过键入 ipython 启动单进程 ipython 终端,然后从 ipython 提示符 (In[1])、cd 到所需目录并键入 %run myfile.py

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-22
    • 2019-12-03
    • 1970-01-01
    • 2023-03-04
    • 2016-12-18
    • 2011-09-30
    相关资源
    最近更新 更多