Python3 jupyter notebook 服务器搭建过程

yipeiwu_com5年前服务器

1. jupyter notebook 安装

•创建 jupyter 目录

mkdir jupyter
cd jupyter/

•创建独立的 Python3 运行环境,并激活进入该环境

virtualenv --python=python3 --no-site-packages venv
source venv/bin/activate

•安装 jupyter

pip install jupyter

2. jupyter notebook 配置

•创建 notebooks 目录

mkdir notebooks

用于保存网页端创建的 ipynb 文件。

•生成配置文件

jupyter notebook --generate-config

生成的配置文件保存在当前用户的 .jupyter 目录下。

•生成密码密文

python -c "import IPython; print(IPython.lib.passwd())"

执行后输入密码,生成类似 'sha1:xxx:xxx' 的密文。

•修改配置文件

c.NotebookApp.allow_remote_access = True    # 允许远程访问
c.NotebookApp.ip = '*'             # 允许任意ip访问此服务器
c.NotebookApp.password = 'sha1:xxx:xxx'     # 上一步生成的密文
c.NotebookApp.open_browser = False       # 运行时不打开本机浏览器
c.NotebookApp.allow_root =True         # 允许使用 root 权限运行
c.NotebookApp.port = 8888            # 指定 jupyter notebook 使用的端口
c.ContentsManager.root_dir = 'notebooks'    # 指定 ipynb 等文件的保存目录

3. 启动 jupyter notebook

•直接运行

jupyter notebook

•后台运行

nohup jupyter notebook > ~/jupyter/jupyter.log 2>&1 &

总结

以上所述是小编给大家介绍的Python3 jupyter notebook 服务器搭建,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对【听图阁-专注于Python设计】网站的支持!

相关文章

python3发送邮件需要经过代理服务器的示例代码

现象:已知,连接的WIFI网络需要通过代理服务器才能连接外网,按照正常的程序无法发送邮件,而直连一个没有代理的网络【如自己的wifi热点】,可以发送邮件。无法发送邮件的提示是: Time...

编写多线程Python服务器 最适合基础

编写多线程Python服务器 最适合基础

编写一个多线程的Python服务器。 多线程Python服务器使用以下主要模块来管理多个客户端连接。 1. Python的线程模块 2. SocketServer的 ThreadingM...

在阿里云服务器上配置CentOS+Nginx+Python+Flask环境

项目运行环境 阿里云(单核CPU, 1G内存, Ubuntu 14.04 x64 带宽1Mbps), 具体购买和ssh连接阿里云本文不做描述。 实用工具 首先进入阿里云后先要升级下apt...

浅析使用Python搭建http服务器

浅析使用Python搭建http服务器

David Wheeler有一句名言:“计算机科学中的任何问题,都可以通过加上另一层间接的中间层解决。”为了提高Python网络服务的可移植性,Python社区在PEP 333中提出了...

Python写的Socks5协议代理服务器

直接上代码: #!/usr/bin/python # Filename s5.py # Python Dynamic Socks5 Proxy # Usage: python...