0

When I open the notebook e.g. at home home / user / Desktop / multifit-master / notebooks / CLS-DE.ipynb.

And then type in the notebook (CLS-DE.ipynb) %cd I get:

home/user 

Shouldn't this be the directory where I opened my notebook? It means :

home / user / Desktop / multifit-master / notebooks / CLS-DE.ipynb 

How to make a notebook in the directory where I open it?

I want to see after typing %cd in CLS-DE.ipynb notebook this directory:

home / user / Desktop / multifit-master / notebooks / CLS-DE.ipynb 

3 Answers 3

1

To answer your first question, %cd executes shell command cd, which means "go to home directory". Your home directory is /home/user.

If you want to change where jupyter saves notebooks:

  • Define it when starting jupyter jupyter notebook --notebook-dir=home/user/Desktop/multifit-master/notebooks for Jupyter or jupyter-lab --notebook-dir=home/user/Desktop/multifit-master/notebooks for JupyterLab.
  • Switch to the required directory before starting jupyter.

To get what you want, i.e. "I want to see after typing %cd in CLS-DE.ipynb notebook this directory", you'd have to change HOME environment variable. I'd never go this way, as number of tools, scripts, libraries etc. might refer to you HOME. Changing it is likely to bring unforeseen consequences, with little benefit.

Sign up to request clarification or add additional context in comments.

Comments

0

option 1 : open terminal, change path where ever you want to and then open jupyter notebook via terminal. jupyter notebook Option 2 : u can use os.chdir

Comments

0

In the terminal use cd to go in to the respective directory. Once there, type "jupyter notebook" in the terminal. This should open the notebook in that directory.

And to make sure that the notebook is open in the directory you wanted, type "%pwd". It means "print working directory".

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.