无法将python3内核添加到Jupyter

流浪者

我想在Jupyter中更改内核的路径,以将其设置为我在计算机中使用的内核。

这是在jupyter中安装的原始内核:

jupyter kernelspec list

可用的内核:
python3 /home/n/.local/share/jupyter/kernels/python3
python2 / usr / local / share / jupyter / kernels / python2

然后我在机器中检查了python3的路径,如下所示:

which python3

/ usr / bin / python3

$ ipython kernelspec列表

我这样删除了python3的内核:

jupyter kernelspec uninstall python3

它成功执行,然后我尝试使用之前找到的路径安装python3,如下所示:

jupyter kernelspec安装/ usr / bin / python3

这给了我这个错误:

sys.exit(KernelSpecApp.launch_instance())中
文件“ / usr / local / bin / jupyter-kernelspec”,第11行,文件“ /usr/local/lib/python2.7/dist-packages/traitlets/config/application” .py“,第658行,在launch_instance app.start()中,
文件“ /usr/local/lib/python2.7/dist-packages/jupyter_client/kernelspecapp.py”,第273行,在start中返回self.subapp.start( )
在开始replace = self.replace中的文件“ /usr/local/lib/python2.7/dist-packages/jupyter_client/kernelspecapp.py”,第143行,
文件“ /usr/local/lib/python2.7/dist” -packages / jupyter_client / kernelspec.py“,行299,在install_kernel_spec shutil.copytree(source_dir,destination)中,
文件” /usr/lib/python2.7/shutil.py“,行171,在copytree中

名称= os.listdir(src)OSError:[Errno 20]不是目录:'/ usr / bin / python3'

然后我寻找这样的正确路径:

python3 -c "import sys; print ('\n'.join(sys.path))"

/usr/lib/python3.4

/usr/lib/python3.4/plat-x86_64-linux-gnu

/usr/lib/python3.4/lib-dynload

/usr/local/lib/python3.4/dist-packages

/usr/local/lib/python3.4/dist-packages/setuptools-28.8.0-py3.4.egg

/ usr / lib / python3 / dist-packages

我试图将其安装如下:

sudo jupyter kernelspec install /usr/lib/python3.4

[InstallKernelSpec]在/usr/local/share/jupyter/kernels/python3.4中安装了kernelspec python3.4

现在,当我启动jupyter时,根本没有Python 3作为内核,我不确定现在该怎么做?

流浪者

我可以使用安装在软件包中的Jupyter附带的anaconda重新安装python3,从而解决了该问题。

您可以通过在此处输入以下命令来安装anaconda:https : //conda.io/docs/user-guide/install/linux.html

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章