Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.2K
Visualizações
How to create and open a jupyter notebook ipynb file directly from terminal

The command jupyter notebook will open the Jupyter directory tree page where you can create a ipynb file.

Is there a way to skip that page and create and open the ipynb file directly on the browser?

I was thinking something like jupyter notebook mynotebook.ipynb

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Open notebook in browser

jupyter notebook <notebook>.ipynb

Create empty, minimal notebook:

"""create-notebook.py
   Creates a minimal jupyter notebook (.ipynb)
   Usage: create-notebook <notebook>
"""
import sys
from notebook import transutils as _
from notebook.services.contents.filemanager import FileContentsManager as FCM

try:
    notebook_fname = sys.argv[1].strip('.ipynb')
except IndexError:
    print("Usage: create-notebook <notebook>")
    exit()

notebook_fname += '.ipynb'  # ensure .ipynb suffix is added
FCM().new(path=notebook_fname)

Alias create-notebook script:

alias create-notebook='python $(pwd)/create-notebook.py'

Putting it all together

create-notebook my_notebook && jupyter notebook my_notebook.ipynb

over 4 years ago · Santiago Trujillo Relatório

0

This can't be the most desirable method. Maybe there's an option native to Jupyter or the extensions, but I haven't come across one, nor have I come across the need to do this. The documentation suggests the developers are encouraging users to land at the dashboard.

Start with an empty notebook Untitled.ipynb. To generate it, save the default file that is created when you create a new notebook from the jupyter dashboard. This empty notebook will be used as a template for creating new, empty notebooks at the command line. The contents of Untitled.ipynb for me, jupyter version 4.4.0, look like this:

$ cat Untitled.ipynb
{
 "cells": [],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}

The file contains the bare minimum needed to launch a notebook using jupyter notebook Untitled.ipynb (and eventually mynotebook.ipynb), any less and it will raise a NotJSONError. You can add some metadata to the template if you want to include a default kernel.

From here, use command substitution to open a new, empty notebook from the command line where Untitled.ipynb is the path to the template notebook created above and mynotebook.ipynb is the name of the notebook you wish to create:

$ jupyter notebook $(cat Untitled.ipynb >mynotebook.ipynb && echo mynotebook.ipynb)
over 4 years ago · Santiago Trujillo Relatório

0

You may try below command.

jupyter nbconvert --to notebook --execute mynotebook.ipynb

According to Jupyter nbconvert manual below, nbconvert with --execute command supports running a notebook.

enter image description here Hope it works for you.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda