Update start_jupyterlab.py
Browse files- start_jupyterlab.py +8 -5
start_jupyterlab.py
CHANGED
|
@@ -42,16 +42,19 @@ def modify_jupyter_config():
|
|
| 42 |
print(f"修改配置文件时出错: {e}")
|
| 43 |
|
| 44 |
def start_jupyter_lab():
|
| 45 |
-
"""启动 JupyterLab 服务并
|
| 46 |
try:
|
| 47 |
print("启动 JupyterLab 服务...")
|
| 48 |
|
|
|
|
| 49 |
command = [
|
| 50 |
sys.executable, "-m", "jupyter", "lab",
|
| 51 |
-
"--no-browser",
|
| 52 |
-
"--ip=0.0.0.0",
|
| 53 |
-
"--port=18888",
|
| 54 |
-
"--allow-root" # 允许以 root 身份运行
|
|
|
|
|
|
|
| 55 |
]
|
| 56 |
|
| 57 |
process = subprocess.Popen(
|
|
|
|
| 42 |
print(f"修改配置文件时出错: {e}")
|
| 43 |
|
| 44 |
def start_jupyter_lab():
|
| 45 |
+
"""启动 JupyterLab 服务并确保禁用 token"""
|
| 46 |
try:
|
| 47 |
print("启动 JupyterLab 服务...")
|
| 48 |
|
| 49 |
+
# 启动命令,使用参数强制覆盖配置
|
| 50 |
command = [
|
| 51 |
sys.executable, "-m", "jupyter", "lab",
|
| 52 |
+
"--no-browser", # 禁止自动打开浏览器
|
| 53 |
+
"--ip=0.0.0.0", # 允许外部访问
|
| 54 |
+
"--port=18888", # 指定端口
|
| 55 |
+
"--allow-root", # 允许以 root 身份运行
|
| 56 |
+
"--NotebookApp.token=''", # 禁用 token
|
| 57 |
+
"--NotebookApp.password=''", # 禁用密码
|
| 58 |
]
|
| 59 |
|
| 60 |
process = subprocess.Popen(
|