sys.path different in Jupyter and Python - how to import own modules in Jupyter?

后端 未结 5 1728
一向
一向 2020-11-30 01:29

In Jupyter my own little module is not loaded but in python/bpython is everything is fine. When typing

import sys
print(sys.path)

the path

5条回答
  •  被撕碎了的回忆
    2020-11-30 02:17

    You can use absolute imports:

    /root
        /app
          /config
            config.py
          /source
            file.ipynb
    
    # In the file.ipynb importing the config.py file
    from root.app.config import config
    

提交回复
热议问题