Running Jupyter with multiple Python and IPython paths

后端 未结 2 1678
粉色の甜心
粉色の甜心 2020-11-30 16:59

I\'d like to work with Jupyter notebooks, but have had difficulty doing basic imports (such as import matplotlib). I think this was because I have several user-managed pytho

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 17:35

    @jakevdp explained it very well.

    When I updated my ubuntu I also had the same problem and I solved it by changing the kernel configuration file(kernel.json). To list the kernel files location. Use

    jupyter kernelspec list
    

    It will return

    Available kernels:
      python3    /home/user1/.local/share/jupyter/kernels/python3
      python2    /usr/local/share/jupyter/kernels/python2
    

    I was using python3 so I changed the file at

    /home/user1/.local/share/jupyter/kernels/python3
    

    by following step

    nano /home/user1/.local/share/jupyter/kernels/python3/kernel.json
    

    There inside argv I changed the first parameter(i.e. python3 directory path) form

    "/usr/bin/python3.5"
    

    to

    "/usr/bin/python3"
    

    and saved it with ctr+x and restarted jupyter-notebook.

提交回复
热议问题