ipython

Installing iPython: “ImportError cannot import name path”?

心不动则不痛 提交于 2019-12-20 16:14:52
问题 I'm trying to install IPython. I have run pip install ipython[notebook] without any errors, but now I get this: $ ipython notebook Traceback (most recent call last): File "/Users/me/.virtualenvs/.venv/bin/ipython", line 7, in <module> from IPython import start_ipython File "/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module> from .terminal.embed import embed File "/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/IPython/terminal/embed.py

IPython Notebook widgets for Matplotlib interactivity

寵の児 提交于 2019-12-20 12:34:19
问题 I would like to use the ipython notebook widgets to add some degree of interactivity to inline matplotlib plots. In general the plot can be quite heavy and I want to only update a specific element of the plot. I understand that widgets have a throttling feature built-in that helps to don't flood the kernel, but when the plot takes let say 30s I don't want to wait so long just to update a line. By reading the example notebooks I was able to create a basic example in which I add a cross cursor

plot() doesn't work on IPython notebook

穿精又带淫゛_ 提交于 2019-12-20 10:43:56
问题 I'm new to python scientific computing, and I tried to make a simple graph on IPython notebook. import pandas plot(arange(10)) Then error had shown as below. --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-2-6b139d572bd6> in <module>() 1 import pandas ----> 2 plot(arange(10)) NameError: name 'plot' is not defined Instead, with IPython --pylab mode, a right graph popped up when I tried the same code. Am I

ipython install new modules

本秂侑毒 提交于 2019-12-20 09:19:18
问题 I am used to the R functionality of installing packages and I am trying to do the same thing with ipython . Sometimes the following method works but then again sometimes it doesn't and I would like to finally find out why it only works half the time. Normally to install a module (like the requests module for example) I would type the following after opening a fresh terminal: $ sudo pip install requests Password: ******* This would then be followed by a message indicating that the install was

IPython Notebook - early exit from cell

ぃ、小莉子 提交于 2019-12-20 08:59:45
问题 I'd like to programmatically exit a cell early in IPython Notebook. exit(0) , however, kills the kernel. Whats the proper way to do this? I'd prefer not to split the cell or manually halt execution. 回答1: I'm reposting my answer from here because the solution should apply to your question as well. It will... not kill the kernel on exit not display a full traceback (no traceback for use in IPython shell) not force you to entrench code with try/excepts work with or without IPython, without

Using Jython through IPython: is readline still an issue?

送分小仙女□ 提交于 2019-12-20 08:56:55
问题 I'd like to use the Jython interpreter with IPython, so that I could use things like tab completion and perhaps the IPython notebook. The IPython FAQ site steps around whether this is possible. I have two questions: Say Jython could work with IPython: how do I actually go about tying them together? When I execute $ ipython , I'm running a Python interpreter. How do I set up IPython so that I run a Jython interpreter? Even if I knew how to do #1, I've searched around and it seems like the

open ipython notebooks (*.ipynb) in read-only view (like a html file)

我们两清 提交于 2019-12-20 08:49:15
问题 Nowadays with more and more ipython notebook files (*.ipynb) around, it is very disturbing every time when I want to peek at some notebook I have to open a server for it, and cannot do it in read-only mode (due to auto-save I can accidentally change the file when reading it if not in read-only mode). I hope something like this: ipython notebook mynb.ipynb --read-only would work, but sadly it doesn't (although still it creates a server which I don't really want in read-only view). What I

How to write text in ipython notebook?

ぐ巨炮叔叔 提交于 2019-12-20 08:48:28
问题 Here is an example of IPython notebook in which besides the input and output cells we have a plain text. How can I do the same in my IPython notebook? At the moment I have inly In and Out cells. 回答1: Change the cell type to Markdown in the menu bar, from Code to Markdown . Currently in Notebook 4.x , the keyboard shortcut for such an action is: Esc (for command mode), then m (for markdown). 回答2: As it is written in the documentation you have to change the cell type to a markdown. 回答3: Simply

Interactive Python: cannot get `%lprun` to work, although line_profiler is imported properly

可紊 提交于 2019-12-20 08:47:12
问题 Problem Most iPython "magic functions" work fine for me right off the bat: %hist , %time , %prun , etc. However, I noticed that %lprun could not be found with iPython as I'd installed it originally. Attempt to Resolve I then discovered that I should install the line_profiler module. I have installed this module, but still cannot seem to get the magic function to work correctly. If I attempt to call %lprun , iPython still cannot find the function. If I call it with the full name ( line

ipython how to execute several history lines

我是研究僧i 提交于 2019-12-20 08:37:00
问题 In ipython, we can use _ih[32:39] To show history lines between 32 and 39. How can I directly execute these history lines? 回答1: You can execute code from previous sessions with %recall . See %recall documentation here. #Execute all code from previous session. %recall ~1/ #Execute all code from two sessions previous the current session. %recall ~2/ #Execute lines 1 to 5 from previous session. %recall ~1/1-5 回答2: I use the list notation: exec In[34:36] also, if you use the edit function to edit