启动ipython运行脚本 [英] Start ipython running a script

查看:138
本文介绍了启动ipython运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的用例是我想在文件中初始化一些函数,然后使用定义的函数启动ipython。有什么办法可以做一些像ipython --run_script = myscript.py吗?

My use case is I want to initialize some functions in a file and then start up ipython with those functions defined. Is there any way to do something like ipython --run_script=myscript.py?

推荐答案

Per

Per the docs, it's trivial:


使用以下命令启动IPython:

You start IPython with the command:



$ ipython [options] files




如果没有选项调用,
执行全部在
序列中列出的文件并将您放入
解释器,同时仍然确认
您在
ipythonrc 文件。这个行为是
与标准Python不同,当调用 python -i
只会
执行一个文件并忽略你的
配置设置。

If invoked with no options, it executes all the files listed in sequence and drops you into the interpreter while still acknowledging any options you may have set in your ipythonrc file. This behavior is different from standard Python, which when called as python -i will only execute one file and ignore your configuration setup.

因此,只需使用 ipython myfile.py 。 ..你在那里! - )

So, just use ipython myfile.py... and there you are!-)

这篇关于启动ipython运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆