我为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?
答案 0 :(得分: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']
并获取群集标签: sudo mkdir / etc / jupyter /
sudo nano /etc/jupyter/jupyter_notebook_config.py
添加:
c.NotebookApp.server_extensions.append('ipyparallel.nbextension')