20

I invoke "jupyter notebook" under:

 [abigail@localhost anaconda3]$ jupyter notebook

By default, it saves to the directory of anaconda3/ with an extension of "ipynb" when I click "File" => "Save".

How to save it to a directory under anaconda3/, instead of the default location? There is not a "save as" command in notebook?

3 Answers 3

26

You can save a notebook to a location of your choice by using the "File" -> "Download as" -> "Notebook (.ipynb)" option from the menu.

Alternatively you can start your notebook server from a different directory and it will save all notebooks to that directory.

A third option is to navigate to the directory you want the notebook to be saved to in the tree view "http://127.0.0.1:8888/tree" prior to creating the notebook.

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

1 Comment

Just cd'ing to the directory I want and running jupyter notebook from there is simple and works grea--thanks for the tip.
8

There are two methods:
1.You can use the magic command %notebook to save as ipynb

  %notebook "directory/to/file/filename.ipynb"     

2.You can use the magic command %%writefile to save as py file

  %%writefile "directory/to/file/filename.py"

In the second method, you should put this command at the top of the cell, otherwise it will throw an error.

1 Comment

The %notebook doesn't quite seem to work. It seems like it is only saving recently executed code, rather than the entire notebook with all markdown cells, etc.
2

It is easiest to select a destination before you create a program using Jupyter Notebook; as then you do not run into this issue.

However, since you have already made a program, one possible solution is to make a copy of the file, move it to your desired location, and then delete the old file. Before doing this, ensure that you have saved it first, otherwise data might be lost.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.