我有一个在Python 2.7 Anaconda环境中运行的Jupyter笔记本。我想在笔记本中添加一个Python 3环境。根据许多不同的互联网指南,我尝试了以下命令的许多变体:
$ sudo /usr/anaconda2/bin/python -m ipykernel install --prefix=/home/madwand/.conda/envs/PostTrans --name PostTrans
[InstallIPythonKernelSpecApp] WARNING | Installing to /home/madwand/.conda/envs/PostTrans/share/jupyter/kernels, which is not in ['/home/madwand/.local/share/jupyter/kernels', '/usr/anaconda2/share/jupyter/kernels', '/usr/local/share/jupyter/kernels', '/usr/share/jupyter/kernels', u'/home/madwand/.ipython/kernels']. The kernelspec may not be found.
Installed kernelspec PostTrans in /home/madwand/.conda/envs/PostTrans/share/jupyter/kernels/posttrans
我可以按如下方式检查环境是否正确安装:
$ sudo /usr/anaconda2/bin/python /usr/anaconda2/bin/jupyter kernelspec list
Available kernels:
python2 /usr/anaconda2/lib/python2.7/site-packages/ipykernel/resources
posttrans /home/madwand/.local/share/jupyter/kernels/posttrans
但是,无论我做什么,“PostTrans”环境都不会出现在Jupyter笔记本中。出了什么问题,我该怎么做让笔记本能够识别Python 3环境?