CentOS7安装jupyter notebook

CentOS7安装jupyter notebook

1.准备conda环境

bash XXX.sh
  • 为conda添加镜像
#重启系统
reboot
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  • 设置默认不开启base环境
conda config --set auto_activate_base false

2.创建虚拟环境

  • 创建
#testenvironment 虚拟环境名称
#python=3.7 设置python版本
conda create -n testenvironment python=3.7
  • 激活环境
conda activate testenvironment
  • delete environment
conda env remove -n testenvironment

3.安装jupyter notebook

#先激活虚拟环境
conda activate testenvironment

conda install -c conda-forge jupyterlab
#pip install jupyterlab -i https://pypi.douban.com/simple/
  • 启动
jupyter notebook --allow-root

4.添加jupyter kernel

  • 激活新创建的虚拟环境
conda activate testenvironment
  • 安装ipykernel
pip install ipykernel -i https://pypi.douban.com/simple/
  • 为内核命名
python -m ipykernel install --name testenvironment
  • 显示所有内核
jupyter kernelspec list
  • delete kernel
jupyter kernelspec remove testenvironment

5.插件配置

# 安装插件配置器
pip install jupyter_nbextensions_configurator -i https://pypi.douban.com/simple/
jupyter nbextensions_configurator enable

# 安装所有插件包
pip install jupyter_contrib_nbextensions -i https://pypi.douban.com/simple/
jupyter contrib nbextension install

# 安装所有主题
pip install jupyterthemes -i https://pypi.douban.com/simple/

常用插件

  • code prettify 美化代码
  • Table of Contents(2)显示内容提纲

6.test

#在notebook中安装包
!pip install numpy pandas matplotlib -i https://pypi.douban.com/simple/

%matplotlib inline
import matplotlib.pyplot as plt
plt.plot([1,2,3])

示例

posted @ 2021-11-01 22:13  不会写代码的花生  阅读(847)  评论(0)    收藏  举报