我在文件中定义了许多模块,并添加from myFile import *到我的ipython笔记本的第一行,以便我可以将它用作此笔记本中其他部分的依赖项.
目前我的工作流程是:
myFile有谁知道是否有办法重新加载所有模块myFile而无需重启Ipython内核?谢谢!
如果它是一个多用户环境并且卸载IPython不是一个选项,那么如何在没有IPython的情况下启动Django shell.
我正在尝试使用ipython建立一个漂亮的spark开发环境.首先启动ipython,然后:
import findspark
findspark.init()
from pyspark.conf import SparkConf
from pyspark.context import SparkContext
conf = SparkConf()
conf.setMaster('yarn-client')
sc = SparkContext(conf=conf)
Run Code Online (Sandbox Code Playgroud)
这是来自应用程序UI,我可以看到执行程序在工作节点上.
但是,当我尝试这个:
rdd = sc.textFile("/LOGS/201511/*/*")
rdd.first()
Run Code Online (Sandbox Code Playgroud)
我明白了:
Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.runJob.
: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 4 times, most recent failure: Lost task 0.3 in stage 0.0 (TID 3, d142.dtvhadooptest.com): org.apache.spark.SparkException:
Error from python worker:
/bin/python: No module named pyspark
PYTHONPATH was:
/data/sdb/hadoop/yarn/local/usercache/hdfs/filecache/64/spark-assembly-1.4.1.2.3.2.0-2950-hadoop2.7.1.2.3.2.0-2950.jar
java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:392)
at org.apache.spark.api.python.PythonWorkerFactory.startDaemon(PythonWorkerFactory.scala:163)
at …Run Code Online (Sandbox Code Playgroud) 调试时,我经常掉入IPython Shell进行交互式代码测试。但是,这也会导致python版本,日期和帮助说明的大量信息转储到stdout。如何抑制此信息,以免掩盖故意的调试消息?
x = get_important_data()
print 'important info! right here! The data is in variable "x"'
import IPython
IPython.embed()
Run Code Online (Sandbox Code Playgroud)
这段代码给出了这样的输出...
important info! right here! The data is in variable "x"
Python 2.7.11 |Anaconda 2.4.0 (x86_64)| (default, Dec 6 2015, 18:57:58)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' …Run Code Online (Sandbox Code Playgroud) 我能够在spyder ide中导入pandas包; 但是,如果我尝试打开一个新的juypter笔记本,导入失败.
我在MAC OS X上使用Anaconda软件包分发.
这是我做的:
In [1]: import pandas
Run Code Online (Sandbox Code Playgroud)
这是我得到的回应:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-97925edf8fb0> in <module>()
----> 1 import pandas
//anaconda/lib/python2.7/site-packages/pandas/__init__.py in <module>()
11 "pandas from the source directory, you may need to run "
12 "'python setup.py build_ext --inplace' to build the C "
---> 13 "extensions first.".format(module))
14
15 from datetime import datetime
ImportError: C extension: hashtable not built. If you want to import pandas from the source directory, you may need …Run Code Online (Sandbox Code Playgroud) 我找不到custom.js使用Python3.5.1在pyenv + virtualenv下安装的Jupyter(笔记本).
有人说custom.js位于~/.jupyter/custom/custom.js但我没有(顺便说一句,我可以创建jupyter_notebook_config.py通过jupyter notebook create).
$ ls ~/.jupyter
jupyter_notebook_config.py migrated
Run Code Online (Sandbox Code Playgroud)
在哪里custom.js或如何创建默认的?我应该从存储库下载吗?
$ pip freeze
ipykernel==4.3.1
ipython==4.1.2
ipython-genutils==0.1.0
ipywidgets==4.1.1
jupyter==1.0.0
jupyter-client==4.1.1
jupyter-console==4.1.1
jupyter-core==4.0.6
Run Code Online (Sandbox Code Playgroud) 我已经找了4个小时以上问题的答案.大多数页面都表示字符串格式化 这不是我想要的.
我想在IPython中为整数和浮点数的千位分隔符设置一个参数.该选项应仅影响数字在交互式会话中的显示方式.我想设置一次参数.我需要为每个新输出做一些格式化的所有解决方案根本不能满足我的需要.我做了一些探索性数据分析,并且不想为每行代码打扰数字格式.
该格式应与所有整数和浮点数一起使用,包括存储在numpy数组或pandas数据帧中的那些.
对于那些熟悉Mathematica的人,我指出了如何在Mathematica中做到这一点:转到preferences => appearance => numbers => format.在那里,您可以"启用自动数字格式化"并选择"数字块分隔符".
示例:如果我在我的ipython会话中输入"600 + 600",我想要以下输出:1'200(其中'将是我的千位分隔符).
我在Spyder和IPython笔记本中使用IPython控制台.谢谢.
伙计们,
我想在我的debian jessie盒子上安装RODEO.我已成功地安装了已安装的竞技场,安装完成没有任何问题.但是,当我在命令行上键入"rodeo"时,我会收到以下错误消息:
xxxxxx@yyyyy:~$ rodeo
/usr/local/lib/python3.4/dist-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated. You should import from ipykernel or jupyter_client instead.
"You should import from ipykernel or jupyter_client instead.", ShimWarning)
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/rodeo/kernel.py", line 3, in <module>
from jupyter_client import BlockingKernelClient
ImportError: No module named 'jupyter_client'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/rodeo", line 9, in <module>
load_entry_point('rodeo==0.4.4', 'console_scripts', 'rodeo')()
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 549, in load_entry_point
return …Run Code Online (Sandbox Code Playgroud) 我在Windows 10中使用ipython Jupyter笔记本.我已经在cmd中使用pip install geohash安装了Geohash.当我尝试使用geohash(import geohash)时出现以下错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-840910eb012f> in <module>()
----> 1 import geohash
ImportError: No module named 'geohash'
Run Code Online (Sandbox Code Playgroud)
再次检查是否安装了geohash,然后在我尝试重新安装时发出以下消息:
C:\Users\Himal Acharya>pip install geohash
Requirement already satisfied (use --upgrade to upgrade): geohash in c:\users\himal acharya\anaconda3\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.3 in c:\users\himal acharya\anaconda3\lib\site-packages (from geohash)
Run Code Online (Sandbox Code Playgroud)
我再次卸载geohash.我从github手动安装geohash但出现同样的问题:导入错误
ipython ×10
python ×6
jupyter ×3
anaconda ×1
apache-spark ×1
django ×1
formatting ×1
geohashing ×1
pandas ×1
pyspark ×1
python-3.x ×1
rodeo ×1
scipy ×1