简体   繁体   中英

Importing Python modules to Jupyter notebook

I have got the next hierarchy:

project_name
|-utils
| |-lib
|   |-module.py
|-notebooks
| |-nb.ipynb

How can I import module.py to the np.ipynb?

Use sys package as follows on nb.ipynb

import sys
sys.path.insert(0,"/path/to/module.py")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM