使用.net语言的ipython cell magic
clrmagic的Python项目详细描述
从Jupyter笔记本电脑使用.NET语言(C,VB.NET,F)的iPython Cell Magic:
https://pypi.python.org/pypi/clrmagic/
基于xavier dupré@sdpython的一篇博文:
http://www.xavierdupre.fr/blog/2014-09-20_nojs.html
简单的车轮安装:
pip install clrmagic
使用ipython内核启动jupyter笔记本:
jupyter notebook
在打开的笔记本中加载clrmagic扩展:
%reload_ext clrmagic
带C代码的魔法电池:
%%CS mypower System.dll public static double mypower(double x, double y) { if (y == 0) return 1.0 ; return System.Math.Pow(x,y) ; } <function clrmagic.create_cs_function.<locals>.<lambda>>
正常iPython单元格中的下一个计算:
mypower(3.0,3.0) 27.0