将 Python 3 内核的 IPython 3 也更改为集群的 python2
Change IPython 3 for Python 3 kernel to python2 for the cluster too
我为 Python 3 安装了 IPython 3,以便与 Jupyterhub 一起工作。
现在我可以使用带有 Python2 内核的笔记本,因为我创建了 /usr/local/share/jupyter/kernels/python2/kernel.json
与:
{
"argv": ["python2", "-m", "IPython.kernel",
"-f", "{connection_file}"],
"display_name": "Python 2",
"language": "python2"
}
现在我也想用IPython.parallel,但是我启动集群的时候会自动启动引擎在Python 3,请问怎么改成Python 2?
我通过
解决了这个问题
sudo mkdir /etc/ipython/
sudo nano /etc/ipython/ipython_config.py
添加这些行:
c = get_config()
c.LocalControllerLauncher.controller_cmd = ['/usr/bin/python2', '-m', 'IPython.parallel.controller']
c.LocalEngineLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'IPython.parallel.engine']
c.LocalEngineSetLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'IPython.parallel.engine']
现在引擎应该以 python2
开头
编辑 Jupyter 1.0 或 IPython 4.0:
更改为
c = get_config()
c.LocalControllerLauncher.controller_cmd = ['/usr/bin/python2', '-m', 'ipyparallel.controller']
c.LocalEngineLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'ipyparallel.engine']
c.LocalEngineSetLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'ipyparallel.engine']
并取回集群选项卡:
须藤 mkdir /etc/jupyter/
sudo nano /etc/jupyter/jupyter_notebook_config.py
添加这个:
c.NotebookApp.server_extensions.append('ipyparallel.nbextension')
我为 Python 3 安装了 IPython 3,以便与 Jupyterhub 一起工作。
现在我可以使用带有 Python2 内核的笔记本,因为我创建了 /usr/local/share/jupyter/kernels/python2/kernel.json
与:
{
"argv": ["python2", "-m", "IPython.kernel",
"-f", "{connection_file}"],
"display_name": "Python 2",
"language": "python2"
}
现在我也想用IPython.parallel,但是我启动集群的时候会自动启动引擎在Python 3,请问怎么改成Python 2?
我通过
解决了这个问题sudo mkdir /etc/ipython/
sudo nano /etc/ipython/ipython_config.py
添加这些行:
c = get_config()
c.LocalControllerLauncher.controller_cmd = ['/usr/bin/python2', '-m', 'IPython.parallel.controller']
c.LocalEngineLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'IPython.parallel.engine']
c.LocalEngineSetLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'IPython.parallel.engine']
现在引擎应该以 python2
开头编辑 Jupyter 1.0 或 IPython 4.0: 更改为
c = get_config()
c.LocalControllerLauncher.controller_cmd = ['/usr/bin/python2', '-m', 'ipyparallel.controller']
c.LocalEngineLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'ipyparallel.engine']
c.LocalEngineSetLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'ipyparallel.engine']
并取回集群选项卡: 须藤 mkdir /etc/jupyter/
sudo nano /etc/jupyter/jupyter_notebook_config.py
添加这个:
c.NotebookApp.server_extensions.append('ipyparallel.nbextension')