Importing custom module into jupyter notebook

后端 未结 7 1987
眼角桃花
眼角桃花 2021-02-05 05:55

Yes, I know this is a recurrent question but I still couldn\'t find a convincing answer. I even read at https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.h

7条回答
  •  一生所求
    2021-02-05 06:21

    If you are on a Unix/Linux system another elegant solution may be creating a "soft link" to the module file helpers.py that you would like to use. Change to the notebooks directory and create the link to the module file this way:

    cd notebooks; ln -fs ../my_project/helpers.py .

    This "soft link" is essentially a pointer (a shortcut) to the original target file. With the link in place you will be import your module file as usual:

    import helpers

提交回复
热议问题