Jupyter notebook中设定py2py3同时使用

来源:互联网 发布:网络打仗游戏 编辑:程序博客网 时间:2024/06/03 11:04

在python中安装jupyter后会发现只有一个版本的kernel,这个时候如果能自由的切换python2 python3将极大的便利我们的码代码过程,具体方法如下:

windows下:

要添加python3的kernel,在Windows下cmd中设置:
C:\ipython3 kernelspec install-self

添加python2的kernel,可以将ipython3改为ipython2,如下:
C:\ipython2 kernelspec install-self


ubuntu16.04下(10/5更新):

安装python2的内核并应用

python2 -m pip install ipykernel

python2 -m ipykernel install --user


安装python3的内核并应用

python3 -m pip install ipykernel

python3 -m ipykernel install --user



Jupyter notebook中设定多版本python Kernel

Jupyter notebook中设定多版本python KernelJupyter notebook中设定多版本python Kernel

 (博主的电脑B盘是系统盘)


打开jupyter后就可以看到两个版本的python可供选择~

Jupyter notebook中设定多版本python Kernel

选择任意一个新建即可实现多版本的切换~


原创粉丝点击