Python:安装ipython,打开.ipynb文件

安装:

pip install ipython
pip install "ipython[notebook]"  
#或者
pip3 install ipython[all]
#用浏览器即时运行调试代码
ipython notebook

修改启动默认目录:

jupyter notebook --generate-config
#Writing default config to: /root/.jupyter/jupyter_notebook_config.py
vim /root/.jupyter/jupyter_notebook_config.py

#修改以下行并打开注释(删除#)
c.NotebookApp.notebook_dir = '/root/python'

配置为服务器模式:

首先设置个启动密码,远程登录需要这个密码:

jupyter notebook password 
#Enter password: 
#Verify password: 
#[NotebookPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_notebook_config.json

修改配置文件:

#c.NotebookApp.allow_origin = '*' #运行所有源访问,默认为localhost。 此配置可不打开
#c.NotebookApp.ip = '127.0.0.1' #只监听本地访问
c.NotebookApp.ip = '0.0.0.0'  #运行所有ip访问
c.NotebookApp.port = 8080  # 运行端口
c.NotebookApp.open_browser = False  # 运行 notebook 应用时不打开浏览器

或者直接:

iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT #开通防火墙端口

jupyter notebook --ip 0.0.0.0 --no-browser --port=8080 --allow-root

#后台:
nohup jupyter notebook &  #将输出和错误信息输出到控制台
nohup jupyter notebook > /dev/null 2>&1 & #将输出和错误信息丢弃
nohup jupyter notebook > info 2> error &  #将输出和错误信息分别输出到文件
#nohup确保这个进程在断开 ssh 连接后依旧运行,& 让进程在后台运行。如果想终止 notebook 应用,请找到含有 jupyter-notebook 的进程,并用 kill 杀掉它。

微软仓库:

https://notebooks.azure.com/xuejianbest/libraries/iptest

安装模块用:

!pip install ...

猜你喜欢

转载自blog.csdn.net/xuejianbest/article/details/85159636