11

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
Thomas K
  • 39,200
  • 7
  • 84
  • 86
john mangual
  • 7,718
  • 13
  • 56
  • 95

1 Answers1

20

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
john mangual
  • 7,718
  • 13
  • 56
  • 95