启动ipython运行脚本 [英] Start ipython running a script
问题描述
我的用例是我想在文件中初始化一些函数,然后使用定义的函数启动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 the docs, it's trivial:
使用以下命令启动IPython:
You start IPython with the command:
$ ipython [options] files
如果没有选项调用,
执行全部在
序列中列出的文件并将您放入
解释器,同时仍然确认
您在
ipythonrc $ c $中设置的任何选项c>文件。这个行为是
与标准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 aspython -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屋!