1.pip更新
pip install --upgrade pip
2.pip版本查看
pip -V
3.jupyter安装及使用
3.1jupyter安装
pip install jupyter
3.2jupyter使用
jupyter notebook --ip=0.0.0.0 --port=8808
然后登录即可
3.3centos下的使用
使用 pip 安装 Jupyter
我们使用 pip 命令安装 Jupyter:
pip install ipython jupyter notebook
配置 Jupyter Notebook
建立项目目录
我们先为 Jupyter 相关文件准备一个目录:
mkdir /data/jupyter
cd /data/jupyter
再建立一个目录作为 Jupyter 运行的根目录:
mkdir /data/jupyter/root
准备密码密文
由于我们将以需要密码验证的模式启动 Jupyter,所以我们要预先生成所需的密码对应的密文。
生成密文
使用下面的命令,创建一个密文的密码:
python -c "import IPython;print IPython.lib.passwd()"
执行后需要输入并确认密码,然后程序会返回一个 'sha1:...' 的密文,我们接下来将会用到它。
修改配置
生成配置文件
我们使用 --generate-config 来参数生成默认配置文件:
jupyter notebook --generate-config --allow-root
生成的配置文件在 /root/.jupyter/ 目录下,可以点此编辑配置。
修改配置
然后在配置文件最下方加入以下配置:
c.NotebookApp.ip = '*'
c.NotebookApp.allow_root = True
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.password = u'刚才生成的密文(sha:...)'
c.ContentsManager.root_dir = '/data/jupyter/root'
其中:
c.NotebookApp.password 请将上一步中密文填入此项,包括 sha: 部分。
你也可以直接配置或使用 Nginx 将服务代理到 80 或 443 端口。
启动 Jupyter Notebook
直接启动
使用以下指令启动 Jupyter Notebook:
jupyter notebook
直接在浏览器输入网址即可