1 远程访问
-
进入虚拟环境
conda activate <虚拟环境>
-
生成配置文件
jupyter notebook --generate-config
-
生成密码(之后输入两次密码)
python -c "import IPython;print(IPython.lib.passwd())"
-
记住生成的密钥
xxxx
-
生成jupyter book 的配置文件
jupyter notebook --generate-config
-
修改配置文件
c.NotebookApp.ip = '127.0.0.0' # 允许访问此服务器的 IP,星号表示任意 IP
c.NotebookApp.password = u'xxxx' # 之前生成的密码hash 字串
c.NotebookApp.port = 9999 # 使用的端口
c.NotebookApp.open_browser = False # 运行时不打开本机浏览器
c.NotebookApp.enable_mathjax = True # 启用 MathJa
c.NotebookApp.notebook_dir = '/data/' # 文件夹
-
运行jupyter book
nohup jupyter notebook --no-browser --port=8080 --ip=127.0.0.1 > jupypter.log 2>&1 &
-
本地浏览器输入
127.0.0.1:8080
2 Jupyter 配置多个 python 不同本版
- 激活和配置内核
Make sure you have ipykernel installed in your environment.
If you are using
pip to install ipykernel in a conda env
, make sure pip is installed:
source activate myenv
conda install pip
conda install ipykernel # or pip install ipykernel
source activate myenv
python -m ipykernel install --user --name myenv --display-name "myenv"
source activate other_env
python -m ipykernel install --user --name other-env --display-name "other-env"
- 删除jupyter-notebook的内核
jupyter-kernelspec remove env_name
- 查看内核
jupyter-kernelspec list
2 Jupyter 安装插件
conda install -c conda-forge jupyter_contrib_nbextensions
conda install -c conda-forge jupyter_contrib_nbextensions
3 Jupyter 安装主题(比较鸡肋)
conda install jupyterthemes
jt -t oceans16 -f fira -fs 9 -cellw 90% -ofs 9 -dfs 9 -T
4 jupytertext 安装
- 还需要安装(必须在base在安装): pip install jupytext
- 在配置文件里添加(jupyter不生效)
#Append this to .jupyter/jupyter_notebook_config.py
c.NotebookApp.contents_manager_class="jupytext.TextFileContentsManager"
-
查看有哪些插件
jupyter labextension list
-
安装插件
jupyter labextension install jupyterlab-jupytext
-
删除插件
jupyter labextension uninstall jupyterlab-jupytext
-
Could not determine jupyterlab build status without nodejs 安装nodejs npm:
yum install -y nodejs npm
升级node:
# 查看版本
node -v
# 清除npm cache
npm cache clean -force
# 安装n模块
npm install -g n
# 不行就这样:npm install -g n -f
# 升级新版本(稳定版 stable ,最新版 latest ,指定版本号v8.11.1)
n latest
# 查看版本号,确认是否升级成功
node -v
哈哈
测试