ipython

How do I change the kernel/python version for iPython?

醉酒当歌 提交于 2019-12-13 02:07:23
问题 I have installed iPython using pip in OS X 10.10, and it gave me the "ipython" and "ipython2" commands, which run great, but which use OS X's default python version 2.7.9. I downloaded and installed the latest release of Python3.4 and can load it with the command "python3," but cannot find a way to get iPython to use this version of python. The iPython Web site states the package can be used with python versions 3.3 and above, but I cannot find any instruction on how to change the default

Unable to run ipython-notebook 2.7 with jupyterhub

ⅰ亾dé卋堺 提交于 2019-12-13 02:03:55
问题 I am trying to run ipython 2.7 notebooks with jupyterhub on Ubuntu 14.04 - but I haven't been able to figure out a way. Any suggestions? I know one needs to add kernels in the file ~/.ipython/kernels.json I have the following in this file: { "argv": ["python3", "-m", "IPython.kernel", "-f", "{connection_file}"], "display_name": "Python 3", "language": "python" } { "argv": ["python2.7", "-m", "IPython.kernel", "-f", "{connection_file}"], "display_name": "Python 2", "language": "python" } 回答1:

save output values in txt file in columns python

独自空忆成欢 提交于 2019-12-13 01:19:31
问题 My input value gives corresponding output values as; my_list = [] for i in range(1,10): system = i,i+2*i my_list.append(system) print(my_list) [(1, 3)] [(1, 3), (2, 6)] [(1, 3), (2, 6), (3, 9)] [(1, 3), (2, 6), (3, 9), (4, 12)] I want output stored in 2 columns; where 1,2,3 is first column elements and 3,6,9 for 2nd column. (1 3) (2 6) (3 9) so on... and then write store these values in text file. For text file, is it possible to generate text file as a part of script? Thanks 回答1: you need to

IPython setting text editor

醉酒当歌 提交于 2019-12-13 00:44:07
问题 Am trying to set ipython default text editor. Using Ipython 0.13.2 Using the %edit magic I get the following message: No default editor available. Specify a GUI text editor in the `IPythonWidget.editor` configurable to enable the %edit magic tried looking for it in IPython tried importing IPythonWidget.. no luck Have checked the following questions: Ipython Configuration - Config Classes Overview also checked the the Overview of Ipython config system. http://ipython.org/ipython-doc/stable

MemoryError in Python but not IPython

寵の児 提交于 2019-12-13 00:03:51
问题 Generally-can you think of any reason why this would happen (i.e. a MemoryError in Python but not in IPython (console--not notebook)?) To be more specific, I'm using sklearn's sgdclassifier in the multiclass and multilabel case. It errors given the following code: model = SGDClassifier( loss='hinge', penalty='l2', n_iter=niter, alpha=alpha, fit_intercept=True, n_jobs=1) mc = OneVsRestClassifier(model) mc.fit(X, y) On calling mc.fit(X, y) , the following error occurs: File "train12-3b.py",

PyQt Windows installer with Anaconda Python--PyQt4 not found; how do I troubleshoot?

邮差的信 提交于 2019-12-12 22:17:00
问题 Note: My first attempt at asking a question was confusing PyQt and pyqt_fit. I've preserved my first attempt below for archival purposes. It seems clear that PyQt should be a prerequisite to getting pyqt_fit working. I installed PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe, available here. I see pyqt-4.10.4-py27_1.tar in \Anaconda\pkgs, and if I run the installer again, it tells me it's installed. Unfortunately, it seems that iPython still isn't finding it: In [5]: from PyQt4 import QtCore, QtGui -

Understanding namespace when using Javascript from Ipython.core.display in Jupyter Notebook

拥有回忆 提交于 2019-12-12 20:28:16
问题 I am having trouble understanding the namespace of the Javascript function that is provided in IPython. from IPython.core.display import display, Javascript display(Javascript(u""" var variable = 'Hello' console.log(variable) """)) [output] Hello The above seems to work fine, but the following throws an error. display(Javascript(u""" var variable = 'Hello' """)) display(Javascript(u""" console.log(variable) """)) [output] Javascript error adding output! ReferenceError: variable is not defined

Vim editor - zsh shell ipython magic %ed cannot find editor

為{幸葍}努か 提交于 2019-12-12 19:09:52
问题 I am trying to use the %ed magic in IPython to use vim as the editor. vim is installed ipython and ipython qtconsole both work zsh is latest as updated with my oh-my-zsh install I exported my prefernce to zsh $ echo "export EDITOR=/usr/bin/vim" >> ~/.zshrc $ echo "export VISUAL=/usr/bin/vim" >> ~/.zshrc However, when I launch IPython and then invoke the %ed magic it fails In [1]: %ed IPython will make a temporary file named: /tmp/ipython_edit_pu4Yql.py Editing.../bin/sh: 1: mvim: not found

Where / how / in what context is ipython's configuration file executed?

不打扰是莪最后的温柔 提交于 2019-12-12 18:28:16
问题 Where is ipython's configuration file, which starts with c = get_config() , executed? I'm asking because I want to understand what order things are done in ipython, e.g. why certain commands will not work if included as c.InteractiveShellApp.exec_lines . This is related to my other question, Log IPython output?, because I want access to a logger attribute, but I can't figure out how to access it in the configuration file, and by the time exec_lines are run, the logger has already started (it

IPython Notebook previous cell content

拥有回忆 提交于 2019-12-12 18:24:16
问题 Is it possible in an IPython-Notebook cell to get the previous (above) cell content ? I can see previous output with %capture magic function but I don't find how to get the previous cell content. 回答1: I didn't find how to get the previous content cell in a cell. But I found another solution, creating a custom magic notebook function to capture the cell content and work with that. 回答2: You can get content of the last executed cell with: In[len(In)-2] 回答3: %recall jupyter_notebook_cell_number