【Ubuntu】添加jupyter notebook的虚拟环境(kernel)

**前置条件:**ubantu系统已经安装好Anaconda,并且Anaconda安装已默认将jupyter notebook安装在base环境。

添加流程:

  1. 步骤1:在终端查看当前已创建的conda虚拟环境
conda info --e
  1. 步骤2:切换到想添加的conda虚拟环境
conda activate "虚拟环境名称"
# 安装命令,注意使用conda安装,如果使用pip安装在下一步会报错
conda install ipykernel
  1. 安装好之后,输入下列命令
python -m ipykernel install --user --name 环境名称 --display-name “环境名称”
  1. 设置完毕后,重新进入base打开jupyter notebook即可,在新建(new)里面选择对应的环境即可。
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. 安装jupyter notebook: 在终端中运行以下命令安装jupyter notebook: ``` sudo apt-get update sudo apt-get install jupyter-notebook ``` 2. 安装中文支持: 在终端中运行以下命令安装中文支持: ``` sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4 ``` 然后重启电脑。 3. 安装jupyter notebook的中文支持: 在终端中运行以下命令安装jupyter notebook的中文支持: ``` sudo pip3 install jupyter sudo pip3 install jupyter_contrib_nbextensions sudo jupyter contrib nbextension install --user sudo jupyter nbextension enable code_prettify/code_prettify sudo jupyter nbextension enable execute_time/ExecuteTime sudo jupyter nbextension enable spellchecker/main sudo jupyter nbextension enable notify/notify sudo jupyter nbextension enable toc2/main sudo jupyter nbextension enable freeze/main sudo jupyter nbextension enable varInspector/main sudo jupyter nbextension enable hide_input_all/hide_input_all ``` 4. 启动jupyter notebook: 在终端中运行以下命令启动jupyter notebook: ``` jupyter notebook ``` 或者在应用程序中找到jupyter notebook,双击启动。 5. 修改jupyter notebook的配置文件: 在终端中运行以下命令打开jupyter notebook的配置文件: ``` jupyter notebook --generate-config ``` 然后使用Vi编辑器编辑配置文件: ``` vi .jupyter/jupyter_notebook_config.py ``` 添加以下代码: ``` c.NotebookApp.locale = 'zh-CN' c.IPKernelApp.pylab = 'inline' # in-line figure when using Matplotlib c.NotebookApp.open_browser = False # 不启动浏览器 ``` 保存文件并退出Vi编辑器。 6. 重新启动jupyter notebook: 在终端中运行以下命令重新启动jupyter notebook: ``` jupyter notebook ``` 现在你应该可以在jupyter notebook中看到中文界面了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值