2012-08-02 76 views
6

有没有办法执行ipython脚本?我的意思并不是Python脚本,而是用简单的语法,因为它会被进入的IPython Shell我可以执行ipython脚本吗?

+0

HTTP: //whathaveyoutried.com/ – Marcin 2012-08-02 18:18:50

回答

12

肯定,只是IPython中使用Python运行它们作为你的一个普通的Python脚本:

$> echo '%time print "hello, world"' > script.ipy 
$> ipython script.ipy 
hello, world 
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s 
Wall time: 0.00 s 
+6

关键是'.ipy'的扩展名,否则它会尝试将它作为普通的python文件运行。 – 2012-08-04 11:39:03

相关问题