install
conda install jupyter notebook
jupyter代理
服务器没连代理,访问不了外网,下载不了外网的模型,jupyter中也跑不了
1,在启动jupyter之前,在终端设置代理
export http_proxy=http://[ip:port] https_proxy=http://[ip:port]
2,启动jupyter
nohup jupyter notebook --notebook-dir=[dir] --ip=0.0.0.0 --port=8888 --allow-root --no-browser --NotebookApp.password=sha1:xxxx &
就可以在jupyter中正常下载外网的模型了。
notebook添加环境
conda activate test
conda install ipykernel
python -m ipykernel install --user --name test --display-name test
jupyter kernelspec list # 查看当前的所有kernel
jupyter kernelspec remove test # 删除jupyter notebook的kernel
添加扩展
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
配置
jupyter notebook --generate-config # 生成配置文件
vim ~/.jupyter/jupyter_notebook_config.py #打开配置文件,配置如下:
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.notebook_dir = '<path>'
c.NotebookApp.allow_root = True
c.NotebookApp.password = 'argon2:$argon2...'
c.NotebookApp.allow_password_change = False
其中,password生成:
jupyter notebook password # 输入密码后,生成token
vim ~/.jupyter/jupyter_notebook_config.json # token在这
直接启动jupyter notebook
即可。
无输出问题
查看日志,有关于zmq的报错,重新安装
pip uninstall pyzmq
pip install pyzmq==19.0.2
connecting to kernel问题
由于装了其他库导致tornado版本高
pip uninstall tornado
pip install tornado==4.5.3
重启jupyter。
“正在启动,请稍等”问题
有多种原因造成,我这边之前好好地,有次装了openai,然后出的问题,是因为在装openai时可能手动把typing_extensions删了,python -m ipykernel install --user
时会报错,重新装回来:pip install typing_extensions
,就行了