Reputation: 45
I wrote fib.pyx
containing fibonacci funciton like that
def fib(int n):
cdef int i
cdef double a=0., b=1.
for i in range(n):
a,b = a+b, a
return a
And I got pyd module with
import pyximport
pyximport.install()
import fib
It worked well. But when I edited fib.pyx
a little and I tried to import it, then the change was not reflected without any error.
After I restart ipython, I tried
pyximport.install(reload_support=True)
import fib
fib.fib(10) # good result
# edit fib.pyx
from importlib import reload
reload(fib)
The reload was well because it succeeded to reload existing fib.pyd
module. But I got the result of older fib function.
How can I recompile fib.pyx
with import fib
?
Is it impossible?
Environment:
Python 3.4.3
Windows 7
IPython 3.2.1
Upvotes: 1
Views: 271
Reputation: 919
Try it with autoreload, if it doesn't work i am afraid you have to restart the kernel process.
[1]: %load_ext autoreload
[2]: %autoreload 2
Upvotes: 1