cython in jupyter notebook

雨燕双飞 提交于 2020-01-13 08:29:42

问题


I am getting errors when loading a Cython file in Jupyter Notebook. Any ideas?

%load_ext Cython

import numpy as np
cimport numpy as np
import cython

Just a simple error message:

File "<ipython-input-3-7e39dc7f561b>", line 5
    cimport numpy as np
                ^
SyntaxError: invalid syntax

回答1:


After reading the docs -- I used two separate cells. The first one is just:

%load_ext Cython

Then my import statements

%%cython

import numpy as np
cimport numpy as np
import cython


来源:https://stackoverflow.com/questions/38768637/cython-in-jupyter-notebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!