快速注释:
此问题基于ipython
的错误跟踪器中的问题#7947。问题似乎是与OSX
相关的问题,或者我的mac上的一些奇怪的设置(可能两者)。我无法在新的Ubuntu盒子上重现它。
我知道潜在的问题可能很复杂。知道它是否可以在OSX
上重现,或者它是否只是我的帮助。
我正在尝试为我的python版本设置多个jupyter
内核。具体来说,我有两个conda
环境sci27
和sci34
,因为名称已经建议前者运行python2.7
解释器,后者运行python3.4
解释器。
所以我现在所做的是:
source activate sci27
conda install ipython-notebook
ipython kernelspec install-self
现在我在/usr/local/share/jupyter/kernels/python2/
{
"display_name": "Python 2",
"language": "python",
"argv": [
"/Users/ch/miniconda/envs/sci27/bin/python",
"-m",
"IPython.kernel",
"-f",
"{connection_file}"
]
}
我在ipython
环境中启动sci34
:
source activate sci34
conda install ipython-notebook
ipython notebook --debug
现在事情变得很奇怪:如果我选择新安装的内核Python 2
,内核会崩溃并输出以下内容:
[D 12:47:53.029 NotebookApp] Opening websocket /api/kernels/4ae0a266-9396-44f7-a529-912056dc6eed/channels
[D 12:47:53.029 NotebookApp] Connecting to: tcp://127.0.0.1:52954
[D 12:47:53.030 NotebookApp] Connecting to: tcp://127.0.0.1:52955
[D 12:47:53.031 NotebookApp] Connecting to: tcp://127.0.0.1:52956
[I 12:47:54.949 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 4ae0a266-9396-44f7-a529-912056dc6eed restarted
[D 12:47:54.954 NotebookApp] Connecting to: tcp://127.0.0.1:52957
/Users/ch/miniconda/envs/sci34/bin/python: No module named IPython
[W 12:47:57.957 NotebookApp] KernelRestarter: restart failed
[W 12:47:57.957 NotebookApp] Kernel 4ae0a266-9396-44f7-a529-912056dc6eed died, removing from map.
ERROR:root:kernel 4ae0a266-9396-44f7-a529-912056dc6eed restarted failed!
[W 12:47:57.975 NotebookApp] Kernel deleted before session
[W 12:47:57.975 NotebookApp] 410 DELETE /api/sessions/70f4d715-807c-4bbc-8a0a-b503aa966606 (::1) 1.40ms referer=http://localhost:8888/notebooks/Untitled2.ipynb?kernel_name=python2
消息/Users/ch/miniconda/envs/sci34/bin/python: No module named IPython
让我感到惊讶。为什么jupyter
会尝试拨打sci34
的翻译而不是sci27
的翻译?
另外,为什么module not found
消息?显然/Users/ch/miniconda/envs/sci34/bin/python -m IPython
工作正常,因为笔记本服务器从sci34
环境运行。