python jupyter notebook ipython
文章目录
在线提供算力的服务商
- colab: colab.google.com
- 九天: jiutian.10086.com
- AutoDL-品质GPU租用平台-租GPU就上AutoDL
- 智星云 AI Galaxy | GPU云服务器 GPU服务器租用 远程GPU租用 深度学习服务器 | 免费GPU 便宜GPU
notebook
security 安全 与 远程登录
- 使用 https 协议
tutorials
commands
1 2 3 4 5 6 7 8# to change a password jupyter notebook password # to use https:// # * generate a certificate openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem # * run with the certificate jupyter notebook --certfile=mycert.pem --keyfile mykey.keyto run notebook as a server to edit file ~/.jupyter/jupyter_notebook_config.py
1 2 3 4 5 6 7 8 9 10 11# Set options for certfile, ip, password, and toggle off # browser auto-opening c.NotebookApp.certfile = u'/absolute/path/to/your/certificate/fullchain.pem' c.NotebookApp.keyfile = u'/absolute/path/to/your/certificate/privkey.pem' # Set ip to '*' to bind on all interfaces (ips) for the public server c.NotebookApp.ip = '*' c.NotebookApp.password = u'sha1:bcd259ccf...<your hashed password here>' c.NotebookApp.open_browser = False # It is a good idea to set a known, fixed port for server access c.NotebookApp.port = 9999解决配置正确,不能远程上网问题
- link:https://blog.csdn.net/keineahnung2345/article/details/85774637
原因一:
- 软件 bug 问题
- 解决方法
- 把 ip 配置的通配符 “ * ” 换成 0.0.0.0
- 即:c.NotebookApp.ip = '0.0.0.0'
原因二:
- 协议不对
- 解决方法:
- 不要用 http, 改用https://
jupyter java
jupyter c++
https://github.com/jupyter-xeus/xeus-cling
using cling
- an interactive shell for c++, based on clang.
注意
完善的安装源只有 conda-forge 源
- 但是,这个暂时不支持 windows
- 有 gouarin 源,但是总是安装失败
安装命令
1conda deactivate; conda env remove -n cling; conda create -n cling python=3.7 ; conda activate cling; conda install -c conda-forge xeus-cling jupyter jupyterlab使用 gouarin
1 2 3conda deactivate; conda env remove -n cling; conda create -n cling python=3.7 ; conda activate cling; conda install -c guarin xeus-cling # 到这里就会失败 conda install -c conda-froge jupyter jupyterlab
使用 docker
使用 cling 命令行,类似 python shell
xeus-python
| |
ipython
autoreload 扩展
参考:
说明: importlib.reload 有时不好使,autoreload 扩展效果更好
调用方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19%load_ext autoreload # 加载 autoreload %autoreload # reload 所有模块(单次) %autoreload 0 # 停止使用 autoreload 功能 %autoreload 1 # 每次执行 ``code cell`` 时都做 reload, # 只是针对 %aimport 设置的模块 %autoreload 2 # 类似 autoreload 1, 但是不执行 %aimport 排除掉(exclude)的模块 %autoreload 3 # 贪婪,reload 所有已有模块,后续新代码,也会被自动加入reload 队列 %aimport # list 列举手动设置的 autoreload %aimport mymodule, mymodule2 # 设置 %autoreload 1 会被reload 的模块 %aimport -mymodule # 设置 %autoreload 排除掉的模块
Jupyter Lite
参考:
特点:
- 完全运行在浏览器中
依赖:
Pyodide
- 通过 js 实现的 python 解释器
jupyter 中的 markdown 和 latex 语法
参考:
三种方法比较:
- IPython.display 不能嵌套使用,局限性大,不灵活
ipywidgets
- 使用灵活,功能全面
- 不过对于大批量数据,渲染时间长,慢
pandas 内置功能
- 只要把对应文本使用 latex 语法整理好就可以
- 简单高效,速度快
使用 IPython.display 库
| |
使用 ipywidgets 库
| |
直接使用 pandas
pandas 内部文本支持在 jupyter 中展示 latex 公式
| |
文章作者
上次更新 2024-01-05 (5c92d1c)