Jupyter-Äquivalent von sys.path[0] (wie man das Verzeichnis der Notebook-Datei erhält)
In Jupyter gibt
jupyter_syspath_example.py
import sys
sys.path[0]nicht das Verzeichnis zurück, in dem sich die Notebook-Datei befindet, sondern etwas wie
jupyter_syspath_output.txt
/usr/lib/python310.zipVerwenden Sie stattdessen
jupyter_notebook_dir.py
import os.path
os.path.dirname(os.path.realpath("__file__"))If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow