从IPython的执行bash命令 [英] execute Bash command from IPython

查看:346
本文介绍了从IPython的执行bash命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要执行从IPython的bash命令时,使用 运营商,从而使我进入我的定义的bash功能,我的源的bash环境:

I want to source my bash environment when executing a bash command from IPython using the ! operator, thus allowing me access to my defined bash functions:

In[2]: !<my_fancy_bash_function> <function_argument>

目前IPython的是采购 SH ,而不是庆典

currently Ipython is sourcing sh rather than bash:

In[3]: !declare -F
sh: 1: declare: not found

如何采购庆典和IPython的设置我的环境设置?

How to source bash and set my environment settings from IPython?

推荐答案

费尔南多·佩雷斯,IPython中的创造者,表明,这

Fernando Perez, creator of IPython, suggests this:

In [1]: %%bash
. ~/.bashrc
<my_fancy_bash_function> <function_argument>

这适用于当前稳定版本(0.13.2)。他承认这是一个有点笨重,欢迎拉请求的。 。

This works on the current stable version (0.13.2). He admits that's a bit clunky, and welcomes pull requests. . .

这篇关于从IPython的执行bash命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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