无法将python3内核添加到Jupyter

Wan*_*rer 5 linux ipython-notebook jupyter jupyter-notebook

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

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

jupyter kernelspec list
Run Code Online (Sandbox Code Playgroud)

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

然后我像这样检查我机器中python3的路径:

which python3
Run Code Online (Sandbox Code Playgroud)

/ usr / bin / python3

$ ipython kernelspec列表

我这样删除了python3的内核:

jupyter kernelspec uninstall python3
Run Code Online (Sandbox Code Playgroud)

它成功执行,然后我尝试使用之前找到的路径安装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))"
Run Code Online (Sandbox Code Playgroud)

/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
Run Code Online (Sandbox Code Playgroud)

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

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

Wan*_*rer 0

我能够通过使用 anaconda 重新安装 python3 来解决这个问题,anaconda 的包中包含 Jupyter。

您可以按照此处的命令安装 anaconda: https ://conda.io/docs/user-guide/install/linux.html