概述
sudo /usr/bin/python3 -m ipykernel install --name python3.6.8
sudo pip373 install ipykernel
sudo python373 -m ipykernel install --name python3.7.3
python373 -m ipykernel install --name python373
ipython kernelspec list
sc create myjupyterservice binpath="D:applyPython373Scriptsjupyter-notebook --config=V:/my_work/jupyter/config/jupyter_notebook_config.py --no-browser -y --allow-root" displayname="my jupyter service " start=auto
C:ProgramDataMicrosoftWindowsStart MenuProgramsStartUp
D:applyPython373Scriptsjupyter-notebook --config=V:/my_work/jupyter/config/jupyter_notebook_config.py --no-browser -y --allow-root > d:myworkjupyterjupyter.log 2>&1
D:applyPython373Scriptsjupyter notebook --no-browser -y --allow-root > d:myworkjupyterjupyter.log 2>&1
mkdir -p d:myworkjupyterfiles
pip373 install --index-url=https://mirrors.huaweicloud.com/repository/pypi/simple --trusted-host=mirrors.huaweicloud.com ipykernel jupyter jupyterlab jupyter_contrib_nbextensions jupyter_nbextensions_configurator tqdm jupyterthemes autopep8
D:applyPython373Scriptsjupyter contrib nbextension install
D:applyPython373Scriptsjupyter nbextensions_configurator enable
D:applyPython373Scriptsjupyter nbextension enable codefolding/main
D:applyPython373Scriptsjupyter nbextension enable code_prettify/code_prettify
D:applyPython373Scriptsjupyter nbextension enable collapsible_headings/main
D:applyPython373Scriptsjupyter nbextension enable equation-numbering/main
D:applyPython373Scriptsjupyter nbextension enable highlight_selected_word/main
D:applyPython373Scriptsjupyter nbextension enable navigation-hotkeys/main
D:applyPython373Scriptsjupyter nbextension enable notify/notify
D:applyPython373Scriptsjupyter nbextension enable ruler/main
D:applyPython373Scriptsjupyter nbextension enable scroll_down/main
D:applyPython373Scriptsjupyter nbextension enable toc2/main
D:applyPython373Scriptsjupyter nbextension enable comment-uncomment/main
D:applyPython373Scriptsjupyter nbextension enable execute_time/ExecuteTime
D:applyPython373Scriptsjupyter nbextension enable export_embedded/main
D:applyPython373Scriptsjupyter nbextension enable highlighter/highlighter
D:applyPython373Scriptsjupyter nbextension enable livemdpreview/livemdpreview
D:applyPython373Scriptsjupyter nbextension enable ruler/edit
D:applyPython373Scriptsjupyter nbextension enable snippets_menu/main
D:applyPython373Scriptsjupyter nbextension enable table_beautifier/main
D:applyPython373Scriptsjupyter nbextension enable codefolding/edit
D:applyPython373Scriptsjupyter nbextension enable execution_dependencies/execution_dependencies
D:applyPython373Scriptsjupyter nbextension enable freeze/main
D:applyPython373Scriptsjupyter nbextension enable python-markdown/main
D:applyPython373Scriptsjupyter nbextension enable runtools/main
D:applyPython373Scriptsjupyter nbextension enable spellchecker/main
D:applyPython373Scriptsjupyter nbextension enable code_prettify/autopep8
D:applyPython373Scriptsjupyter nbextension enable datestamper/main
D:applyPython373Scriptsjupyter nbextension enable nbTranslate/main
D:applyPython373Scriptsjupyter nbextension enable scratchpad/main
D:applyPython373Scriptsjupyter nbextension enable tree-filter/index
D:applyPython373Scriptsjupyter notebook --generate-config -y
/usr/bin/sed -i "s|#c.NotebookApp.notebook_dir = ''|c.NotebookApp.notebook_dir = '/app/jupyter/files/'|g" /root/.jupyter/jupyter_notebook_config.py
/usr/bin/sed -i "s|#c.NotebookApp.open_browser = True|c.NotebookApp.open_browser = False|g" /root/.jupyter/jupyter_notebook_config.py
/usr/bin/sed -i "s|#c.NotebookApp.ip = 'localhost'|c.NotebookApp.ip = '0.0.0.0'|g" /root/.jupyter/jupyter_notebook_config.py
/usr/bin/sed -i "s|#c.NotebookApp.port = 8888|c.NotebookApp.port = 12345|g" /root/.jupyter/jupyter_notebook_config.py
/usr/bin/sed -i "s|#c.NotebookApp.allow_remote_access = False|c.NotebookApp.allow_remote_access = True|g" /root/.jupyter/jupyter_notebook_config.py
passwd_sha=`/usr/bin/python373 -c "from notebook.auth import passwd;print(passwd('mima'));"`
/usr/bin/sed -i "s|#c.NotebookApp.password = ''|c.NotebookApp.password = '$passwd_sha'|g" /root/.jupyter/jupyter_notebook_config.py
/usr/local/python374/bin/jupyter contrib nbextension install
/usr/local/python374/bin/jupyter nbextensions_configurator enable
/usr/local/python374/bin/jupyter nbextension enable codefolding/main
/usr/local/python374/bin/jupyter nbextension enable code_prettify/code_prettify
/usr/local/python374/bin/jupyter nbextension enable collapsible_headings/main
/usr/local/python374/bin/jupyter nbextension enable equation-numbering/main
/usr/local/python374/bin/jupyter nbextension enable highlight_selected_word/main
/usr/local/python374/bin/jupyter nbextension enable navigation-hotkeys/main
/usr/local/python374/bin/jupyter nbextension enable notify/notify
/usr/local/python374/bin/jupyter nbextension enable ruler/main
/usr/local/python374/bin/jupyter nbextension enable scroll_down/main
/usr/local/python374/bin/jupyter nbextension enable toc2/main
/usr/local/python374/bin/jupyter nbextension enable comment-uncomment/main
/usr/local/python374/bin/jupyter nbextension enable execute_time/ExecuteTime
/usr/local/python374/bin/jupyter nbextension enable export_embedded/main
/usr/local/python374/bin/jupyter nbextension enable highlighter/highlighter
/usr/local/python374/bin/jupyter nbextension enable livemdpreview/livemdpreview
/usr/local/python374/bin/jupyter nbextension enable ruler/edit
/usr/local/python374/bin/jupyter nbextension enable snippets_menu/main
/usr/local/python374/bin/jupyter nbextension enable table_beautifier/main
/usr/local/python374/bin/jupyter nbextension enable codefolding/edit
/usr/local/python374/bin/jupyter nbextension enable execution_dependencies/execution_dependencies
/usr/local/python374/bin/jupyter nbextension enable freeze/main
/usr/local/python374/bin/jupyter nbextension enable python-markdown/main
/usr/local/python374/bin/jupyter nbextension enable runtools/main
/usr/local/python374/bin/jupyter nbextension enable spellchecker/main
/usr/local/python374/bin/jupyter nbextension enable code_prettify/autopep8
/usr/local/python374/bin/jupyter nbextension enable datestamper/main
/usr/local/python374/bin/jupyter nbextension enable nbTranslate/main
/usr/local/python374/bin/jupyter nbextension enable scratchpad/main
/usr/local/python374/bin/jupyter nbextension enable tree-filter/index
/usr/local/python374/bin/jupyter notebook --generate-config -y
sed -i "s|#c.NotebookApp.notebook_dir = ''|c.NotebookApp.notebook_dir = '/home/my/my_works/jupyter/files/'|g" /home/my/.jupyter/jupyter_notebook_config.py
sed -i "s|#c.NotebookApp.open_browser = True|c.NotebookApp.open_browser = False|g" "/home/my/.jupyter/jupyter_notebook_config.py"
sed -i "s|#c.NotebookApp.ip = 'localhost'|c.NotebookApp.ip = '0.0.0.0'|g" "/home/my/.jupyter/jupyter_notebook_config.py"
sed -i "s|#c.NotebookApp.port = 8888|c.NotebookApp.port = 12345|g" "/home/my/.jupyter/jupyter_notebook_config.py"
sed -i "s|#c.NotebookApp.allow_remote_access = False|c.NotebookApp.allow_remote_access = True|g" "/home/my/.jupyter/jupyter_notebook_config.py"
passwd_sha=`/usr/bin/python374 -c "from notebook.auth import passwd;print(passwd('mima'));"`
sed -i "s|#c.NotebookApp.password = ''|c.NotebookApp.password = '$passwd_sha'|g" "/home/my/.jupyter/jupyter_notebook_config.py"
3. sudo vi /etc/systemd/system/myjupyter.service
[Unit]
Description=Jupyter server
ConditionPathExists=/home/my/my_works/jupyter/rc.local
[Service]
Type=forking
ExecStart=/home/my/my_works/jupyter/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
4. vi /home/my/my_works/jupyter/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo "看到这行字,说明添加自启动脚本成功。" > /home/my/my_works/jupyter/logs/myjupyter.log
/usr/local/python374/bin/jupyter-notebook --config=/home/my/my_works/jupyter/config/jupyter_notebook_config.py --no-browser -y --allow-root >> /home/my/my_works/jupyter/logs/myjupyter.log
exit 0
5、给rc.local加上权限
sudo chmod +x /home/my/my_works/jupyter/rc.local
6、启用服务
sudo systemctl enable myjupyter.service
7、启动服务并检查状态
sudo systemctl start myjupyter.service
sudo systemctl status myjupyter.service
8、重启并检查test.log文件
cat /home/my/my_works/jupyter/logs/myjupyter.log
转载于:https://my.oschina.net/mengyoufengyu/blog/3076822
最后
以上就是幽默冰淇淋为你收集整理的jupyter部署安装的全部内容,希望文章能够帮你解决jupyter部署安装所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复