问题
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