问题描述
尽管我付出了很多努力,但我还是无法在 Canopy 上为我的 IPython/Jupyter 笔记本安装 R 内核.
Despite all my efforts, I wasn't able to install the R kernel for my IPython/Jupyter notebook on Canopy.
我已严格遵守以下明确说明:http://www.michaelpacer.com/maths/r-kernel-for-ipython-笔记本(或者,http://irkernel.github.io/installation/)
I've closely followed the clear instructions given in:http://www.michaelpacer.com/maths/r-kernel-for-ipython-notebook(or, alternatively, http://irkernel.github.io/installation/)
一切顺利,直到在 Jupyter 上安装内核的最后一步:
All goes well until the last step that install the kernel on Jupyter:
IRkernel::installspec()
这是我收到的奇怪信息:
Here is the weird message I get:
File "/Users/julien/Library/Enthought/Canopy_64bit/User/bin/jupyter-kernelspec", line 8
from jupyter_client.kernelspecapp import KernelSpecApp.launch_instance
^
SyntaxError: invalid syntax
我的配置如下:
- 配备 El Capitan 的 Macbook
- R 版本 3.2.2
- IPython 4.0.1
- Jupyter 4.0.6
推荐答案
事实证明文件jupyter-kernelspec"由于某种原因已损坏.我用下面的代码替换了它:
It turns out that the file "jupyter-kernelspec " was corrupted for some reason. I replaced it by the following code:
#!/usr/bin/env python
from jupyter_client.kernelspecapp import KernelSpecApp
def main():
KernelSpecApp.launch_instance()
if __name__ == '__main__':
main()
它解决了我的问题.
朱利安
这篇关于安装 RKernel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!