1

在尝试为我的 JupyterHub 实例设置 python 2 内核时,我已将以下代码添加到 Dockerfile 中以获取我想要运行的图像之一:

RUN pip install -U ipython
RUN python2 -m pip install ipykernel
RUN python2 -m ipykernel install --user

我从这里得到的:https ://ipython.readthedocs.io/en/latest/install/kernel_install.html

但是,当我启动 Jupyterhub 时,尽管我选择了“Python 2”内核,但我仍然看到该图像正在运行 python 3: 在此处输入图像描述

在我的 docker 容器/笔记本环境中,/usr/share/jupyter/kernels我看到了这个:

sh-4.2$ pwd
/usr/share/jupyter/kernels
sh-4.2$ ls
python2  python3

当我进入时,python2我看到一个kernel.json包含以下内容的文件:

{
 "display_name": "Python 2",
 "language": "python",
 "argv": [
  "python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ]
}

果然, 的输出python --versionPython 2.7.5

但是,当我启动笔记本并检查时,/proc/{pid}/cmdline我看到内核Python 2是使用 in 中的二进制文件启动的/usr/bin/python3.4,这显然不是Python 2。

我在这里做错了什么?

4

0 回答 0