Jupyter notebook 环境配置 (安装与代码补全) 错误提示:Jupyter command `jupyter-contrib` not found.

Background:
话说每次读Jupyter总想起外星(木星)人...
之前有用PyCharm做一些深度学习, 但是PyCharm在离开校园就要收费, 用了免费的Jupyter 这个还可以实现实时交互 (PyCharm也可以, 都类似Matlab, 最早我知道在Xcode上有见过)
Issues:

安装

  1. 在Mac/Windows配置Jupyter环境,
  2. 并实施代码自动补全,
    Solution:
    Jupyter series 包含三个APPs, 分别是传统的Jupyter notebook;
    带有IDE气息的Jupyter Lab 以及 将Jupyter notebook转换为HTML应用的Voila. 编程时候使用jupyternote和jupyterlab都没问题.
    在安装anaconda 官网下载安装即可后, 使用如下安装notebook:
# conda 安装 -集合 conda-合成 jupyternotebook
conda install -c conda-forge notebook
#上面的conda 也可以换成pip方式安装
pip install notebook

安装好后在Terminal执行

jupyter notebook

就可以运行.


Screen Shot 2020-08-10 at 11.28.58 AM.png

请注意的是这里还可以通过anaconda的界面点集jupyternote下的launch进行运行:


Screen Shot 2020-08-10 at 11.29.53 AM.png

对于安装jupyter lab & voila参考代码如下:

conda install -c conda-forge jupyterlab
#或者
pip install jupyterlab
conda install -c conda-forge voila
#或者
pip install voila

运行时候在terminal输入:
jupyter lab启用IDE


Screen Shot 2020-08-10 at 11.36.27 AM.png

在terminal输入voila启用volia


Screen Shot 2020-08-10 at 11.34.48 AM.png

代码补全

在网上看了好多, 大家这么做,大致分为两种, 他们都是对nbextensions的安装与对Hinterland的调用:

代码补全方法一

在anaconda中launch jupyternote 使用anaconda集成好的nbextensions

代码补全方法二

终端输入

#1.安装 nbextensions 
pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple
jupyter contrib nbextension install --user
#2.安装 nbextensions_configurator
pip install --user jupyter_nbextensions_configurator 
jupyter nbextensions_configurator enable --user

但是我遇到如下错误, 提示Jupyter command jupyter-contrib not found.:

Screen Shot 2020-08-10 at 10.42.18 AM.png

这里有两个方法, 第一是按照官方做法补充提示缺少的该包, 即将上面包换成提示缺少进行pip与jupyter,
第二种简单一些, 删除匹配安装使用conda安装, 成功在顶栏出现nbextension字样,点击在hinterland前打对勾, 成功:

# 删除原先安装的 jupyter_contrib_nbextension 包
pip uninstall jupyter_contrib_nbextensions
pip uninstall jupyter_nbextensions_configurator
# 使用conda代替
conda install -c conda-forge jupyter_contrib_nbextensions
jupyter contrib nbextension install --sys-prefix
Screen Shot 2020-08-10 at 11.49.08 AM.png

你可能感兴趣的:(Jupyter notebook 环境配置 (安装与代码补全) 错误提示:Jupyter command `jupyter-contrib` not found.)