美文网首页
jupyter 增加和删除kernel

jupyter 增加和删除kernel

作者: 默写年华Antifragile | 来源:发表于2019-06-14 15:18 被阅读0次
    1. 查看当前 jupyter 中有哪些 kernel
    jupyter kernelspec list
    

    --------------------------------------------------------------------------------------------

    1. 删除指定 kernel
    jupyter kernelspec remove kernel_name
    

    -----------------------------------------------------------------------------------------------

    1. 增加指定 kernel
    • 先进入相应的虚拟环境 conda activate name
    • 然后再用 which python找到当前虚拟环境下的 python 位置
    (pytorch) user-name@406:~$ which python
    /home/user-name/anaconda3/envs/pytorch/bin/python
    
    • 然后再输入,其中 XXXX 是你想要的 kernel name,由于权限问题可能要加 sudo
    sudo /home/user-name/anaconda3/envs/pytorch/bin/python -m ipykernel install --name XXXX
    

    注意:这里不能直接使用 sudo python 因为这样会对应到默认的python,而不是虚拟环境中的 python,因此直接输入虚拟环境的具体位置

    相关文章

      网友评论

          本文标题:jupyter 增加和删除kernel

          本文链接:https://www.haomeiwen.com/subject/jwcpfctx.html