ipython

Issues with tk in ipython/jupyter

天涯浪子 提交于 2020-05-16 13:51:14
问题 I am trying to write a gui for launching from an ipython/jupyter notebook but am running into trouble using tkinter from the notebook, especially in getting the tk gui window to close gracefully. What are best practices for how to make/launch a tkinter gui from jupyter and then close it without killing the ipython kernel? This is my first time trying to use tkinter. I found a lot of detailed info about how to do this with older ipython versions (e.g., iPython 3.2), but not as much for more

How to add new default packages to virtualenv?

这一生的挚爱 提交于 2020-05-15 05:47:06
问题 When I create a virtualenv, it installs setuptools and pip. Is it possible to add new packages to this list? Example use cases: Following this solution to use ipython in virtualenv (from this question) requires installing ipython in every virtualenv (unless I allow system-site-packages). Or if I'm doing a only flask/pygame/frameworkp development, I'd want it in every virtualenv. 回答1: You can use bootstrap scripts to do whatever you want See https://virtualenv.pypa.io/en/latest/reference.html

ImportError: No module named IPython

时光怂恿深爱的人放手 提交于 2020-05-14 14:52:06
问题 When i try to use from IPython.display import clear_output, display_html , then i show the error: (ImportError: No module named IPython) I am using Python 2.7.13, and im trying to make the game of life from John Conway. I am following this link: http://nbviewer.jupyter.org/url/norvig.com/ipython/Life.ipynb I have read another questions and answers about it, but any answer works for me. First, this error is showed in command line, and when i try to run this code in a file. Second, this error

How do I embed a gif in Jupyter notebook?

放肆的年华 提交于 2020-05-11 05:09:06
问题 I've been trying to display a gif in Jupyter notebook and have had some trouble. I keep getting a blank image file. I've tried using html from this GitHub repository. ![wignerfunction][1](../gifs/wigner_rotation_animate.gif "wigner") And from IPython.display import Image Image(url='example.gif') None of the above have worked so far. Thanks 回答1: I've been trying to display a gif in Jupyter notebook and have had some trouble. To display gif in notebook you can use inline markup on a Markdown

ipywidgets dropdown widgets: what is the onchange event?

安稳与你 提交于 2020-05-11 03:52:46
问题 I can register a handler to button.on_click in ipython notebook widgets, but I don't know how to do the same for a dropdown widget import ipywidgets as widgets from IPython.display import display def on_button_clicked(b): print("Button clicked.") button = widgets.Button(description="Click Me!") display(button) button.on_click(on_button_clicked) But for choose_task = widgets.Dropdown( options=['Addition', 'Multiplication', 'Subtraction'], value='Addition', description='Task:', ) there seems to

autoreload and package causing TypeError: super(type, obj): obj must be an instance or subtype of type

纵然是瞬间 提交于 2020-05-10 07:26:27
问题 I have python code spanning several files which I packaged up for convenience, ending up with the following 3 files under my_package directory: __init__.py contents: from file1 import * from file2 import * file1.py contents: class Base(object): pass file2.py contents: from file1 import Base class Derived(Base): def __init__(self): return super(Derived, self).__init__() I then execute in IPython: >>>%autoreload 2 >>>import my_package >>>t = my_package.Derived() So far so good. But then I make

Losing jupyter notebook ssh connection kills kernel

岁酱吖の 提交于 2020-05-10 04:33:25
问题 I have an Ipython Jupyter kernel running on in an AWS VPN that I tunnel to a port my laptop where I connect to with a browser. I am finding that the kernel dies whenever I lose the tunnel and I have to run my notebook from the beginning. What is the likely cause of this and how can I prevent it? It is only the notebook kernels that die, the notebook server stays up. 回答1: I admit that this seems odd. I wonder if there is something in the notebook that is killing the kernel. This can happen.

Losing jupyter notebook ssh connection kills kernel

徘徊边缘 提交于 2020-05-10 04:32:06
问题 I have an Ipython Jupyter kernel running on in an AWS VPN that I tunnel to a port my laptop where I connect to with a browser. I am finding that the kernel dies whenever I lose the tunnel and I have to run my notebook from the beginning. What is the likely cause of this and how can I prevent it? It is only the notebook kernels that die, the notebook server stays up. 回答1: I admit that this seems odd. I wonder if there is something in the notebook that is killing the kernel. This can happen.

How to write a cell magic that knows the input number of the cell?

这一生的挚爱 提交于 2020-05-09 17:09:42
问题 Is there a way to write a cell magic that knows the input number of the cell? By "input number" I mean the ? in the cell's In[?] prefix. At first glance, it seems that IPython.core.magic.cell_magic only knows about the cell content -- it there any way to go beyond that? 回答1: This information is provided by the execution_count of the current instance of the IPython shell, that can be obtained with get_ipython : print(get_ipython().execution_count) 来源: https://stackoverflow.com/questions

【目录】利用Python进行数据分析(第2版)

时光怂恿深爱的人放手 提交于 2020-05-09 10:35:47
第一章 准备工作 1.1 What Is This Book About(这本书是关于什么的) 1.2 Why Python for Data Analysis?(为什么使用Python做数据分析) 1.3 Essential Python Libraries(一些重要的Python库) 1.4 Installation and Setup(安装和设置) 1.5 Community and Conferences(社区和讨论组)+ 私货 1.6 Navigating This Book(本书导航) 第一章 准备工作 2.1 The Python Interpreter(Python解释器) 2.2 IPython基础 2.3 Python语言基础 来源: oschina 链接: https://my.oschina.net/u/4391345/blog/4271623