How do I reset the Jupyter/IPython input prompt numbering?
I think, the only way to to what you want is: – ‘Kernel > Restart’ (restart the kernel) and then ‘Cell > Run All’ (run the script).
I think, the only way to to what you want is: – ‘Kernel > Restart’ (restart the kernel) and then ‘Cell > Run All’ (run the script).
alias ipy=”python -c ‘import IPython; IPython.terminal.ipapp.launch_new_instance()'” This is a great way of always being sure that the ipython instance always belongs to the virtualenv’s python version. This works only on ipython >2.0. Source
IPython expands variables with $name, bash-style. This is true for all magics, not just %run. So you would do: In [1]: filename = “myscript.py” In [2]: %run $filename [‘myscript.py’] myscript.py contains: import sys print(sys.argv) Via Python’s fancy string formatting, you can even put expressions inside {}: In [3]: args = [“arg1”, “arg2”] In [4]: %run … Read more
The following is very unsafe, but you can remove the password completely with: jupyter notebook –ip=’*’ –NotebookApp.token=” –NotebookApp.password=” Without –NotebookApp.password=”, when connecting from a remote computer to a local Jupyter launched simply with: jupyter notebook –ip=’*’ it still asks for a password for security reasons, since users with access can run arbitrary Python code on … Read more
You can’t copy to IPython directly. This are the steps: Copy the lines you want to copy into IPython into the clipboard Enter %paste into IPython Press enter Profit!
To set IPython Notebook to run Python 3 instead of 2 on my MAC 10.9, I did the following steps $ sudo pip3 install ipython[all] Then $ ipython3 notebook
If you just want an interactive interpreter, bpython should be fine. Just use it until you miss some feature you liked about IPython. There are lots of features that IPython offers over bpython: Special threading options. I like -gthread for experimenting with PyGTK and -pylab for matplotlib. direct invocation of shell commands. cd in IPython … Read more
Be sure you have installed the pyreadline library. It is needed for tab completion and other IPython functions – in Windows it doesn’t come with the IPython package and you have to install it separately – > pip install pyreadline
From the notebook menu you can save the file directly as a python script. Go to the ‘File’ option of the menu, then select ‘Download as’ and there you would see a ‘Python (.py)’ option. Another option would be to use nbconvert from the command line: jupyter nbconvert –to script ‘my-notebook.ipynb’ Have a look here.
adding to previous answers, to get the notebook name run the following in a cell: %%javascript IPython.notebook.kernel.execute(‘nb_name = “‘ + IPython.notebook.notebook_name + ‘”‘) this gets you the file name in nb_name then to get the full path you may use the following in a separate cell: import os nb_full_path = os.path.join(os.getcwd(), nb_name)