2021年4月2日星期五

How to import my own Cython module to jupyter notebook

The problem is I can't import my Cython module to jupyter notebook. I no clues but wonder if this has something to do with multiple conda envs I used.

Inside a cythonDir, I wrote a .pyx file with a single function defined and it was compiled successfully via a setup.py. Strangely, I can't import it to my current notebook, which is in the same directory as cythonDir. I have no problem importing the module into an interactive python terminal under parentDir though.

The overall directory tree:

- parentDir    - notebook.ipynb    - cythonDir  

One thing to note is that my jupyter is installed in a conda env proj and the notebook is running with another kernel (environment) tf2. (the cython module is compiled under tf2).

I was doing this in order to install a single jupyter and to work with different envs via switching Kernel inside jupyter.

Thanks in advance!

https://stackoverflow.com/questions/66927903/how-to-import-my-own-cython-module-to-jupyter-notebook April 03, 2021 at 01:07PM

没有评论:

发表评论