-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jupyter.txt
87 lines (61 loc) · 3.38 KB
/
Jupyter.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
官网
https://jupyter.org/
1 安装视频
ubuntu+conda 方式
https://www.bilibili.com/video/BV1fQ4y1X7KD
windows+venv方式
https://www.bilibili.com/video/BV1no4y127wJ
在环境中安装软件
https://www.bilibili.com/video/BV1wo4y127Ap
2 windows上通过cmd执行jupyter数字实验室中的py应用的命令模板。以下四种都可以参考(通过os.system 执行)
"cd/d D:\jupyter\project\各种问题\&&D:\programdata\miniconda3\envs\jupyterpy38\python.exe cmd调用测试1.py"
start cmd /c "cd/d D:\jupyter\project\各种问题\&&D:\programdata\miniconda3\envs\jupyterpy38\python.exe cmd调用测试1.py"
start cmd /c "cd/d D:\jupyter\project\各种问题\&&conda activate D:\programdata\miniconda3\envs\jupyterpy38&&python cmd调用测试1.py"
"cd/d D:\jupyter\project\各种问题\&&conda activate D:\programdata\miniconda3\envs\jupyterpy38&&python cmd调用测试1.py"
3 jupyterlab Notebook 导出网页并修改js 去除codecell等 (使用正则表达式)
-----------------------------------------------------------------------------------------------------------------------------------------------
"""
for jupyterlab 2.x.
# 1 替换静态资源(js css等)位置 2 去掉 代码单元格 和 弹出框
"""
import re
r = '(\\<div class="input"\\>[\\s]*\\<div class="prompt input_prompt"\\>[^<]*</div>[\\s]*\\<div class="inner_cell"\\>[\\s]*\\<div class="input_area"\\>[\\s]<div class=" highlight hl-ipython3">[\\s\\S]+?)<div class="output_wrapper">'
rr = '(<div class="prompt output_prompt">[\s\S]+?</div>)'
with open("例子.html", encoding="utf-8") as f:
s = f.read()
s = s.replace("https://cdnjs.cloudflare.com", "/static/jupyter")
l = re.findall(r, s)
for i in l:
s = s.replace(i, "")
l = re.findall(rr, s)
for i in l:
s = s.replace(i, "")
with open("result.html", "w", encoding="utf-8") as f:
f.write(s)
---------------------------------------------------------------------------------------------------------------------------------------------------
"""
for jupyterlab 3.x.
# 1 替换静态资源(js css等)位置 2 去掉 代码单元格 和 弹出框
Tested well on 3.4.x
"""
import re
r = '(\\<div class="jp-InputArea jp-Cell-inputArea"\\>[\\s\\S]\\<div class="jp-InputPrompt jp-InputArea-prompt"\\>[^<]*</div>[\\s]*\\<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline"\\>[\\s]*\\<div class="CodeMirror cm-s-jupyter"\\>[\\s]<div class=" highlight hl-ipython3">[\\s\\S]+?)<div class="jp-Cell-outputWrapper">'
rr = '(<div class="jp-OutputPrompt jp-OutputArea-prompt">[^<]*</div>)'
with open("例子.html", encoding="utf-8") as f:
s = f.read()
s = s.replace("https://cdnjs.cloudflare.com", "/static/jupyter")
l = re.findall(r, s)
for i in l:
s = s.replace(i, "</div>")
l = re.findall(rr, s)
for i in l:
s = s.replace(i, "")
with open("result.html", "w", encoding="utf-8") as f:
f.write(s)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
4 jupyter 删除内核
jupyter kernelspec list 内核列表
jupyter kernelspec remove或删除内核jupyter kernelspec uninstall
5 在 Jupyter Notebook 中使用 .NET for Apache Spark(C# F# powershell)
https://docs.microsoft.com/zh-cn/dotnet/spark/how-to-guides/dotnet-spark-jupyter-notebooks
https://github.com/dotnet/interactive/blob/main/docs/NotebookswithJupyter.md