- 1. Install Python
- 2. Install Conda
- 3. Optional Install Navigator
- 4. Repository notebook-jupyter
- 5. Create Directory
- 6. Setup Environment Variable
- 7. Install Jupyter Lab
- 8. Setup Configuration
- 9. Launch JupyterLab
- 10. JupyterLab Verification
- 11. Common Command
- 12. Jupyter Rust
- 13. Optional Command
- 14. Rust Verification
- 15. Jupyter Starter
- 16. Jupyter Loader
- 17. Jupyter Execute Command
- 18. Bash Kernel
2. Install Conda
-
Conda是开源包和环境管理系统,此处选择Python3.12版本;
-
Miniconda3-py312_24.3.0-0-Windows-x86_64.exe
-
PATH:D:\Install\Dev\Conda\condabin
conda --version && conda info --envs
conda 24.1.2
base D:\Install\Dev\Conda
3. Optional Install Navigator
-
若要使用Rust,请用Navigator方式安装JupyterLab;
conda install anaconda-navigator -y
-
官方说安装Anaconda Distribution自带Navigator,实际无法正常运行;
-
搜索栏搜索:Anaconda Navigator,然后固定到开始屏幕,以管理员方式运行;
-
向下滚动滑轮,选择安装JupyterLab,点击Launch启动
-
Anaconda Navigator界面字体过小,设置环境变量:QT_SCALE_FACTOR=1.5
5. Create Directory
# PowerShell执行
@('data','config','search','runtime','notebook','workspace') |
ForEach-Object {
New-Item (Join-Path 'D:/Install/Dev/workspace/jupyter-module/' $_) -ItemType Directory -force
}
6. Setup Environment Variable
-
案例如:setx /M PATH "%%JAVA_HOME%%\bin;%PATH%;"
-
setEnvironmentVariable.bat,管理员身份运行;
@echo 请以管理员身份运行
setx /M JUPYTER_BASE "D:/Install/Dev/workspace/jupyter-module"
setx /M JUPYTER_DATA_DIR "%%JUPYTER_BASE%%\data"
setx /M JUPYTER_CONFIG_DIR "%%JUPYTER_BASE%%\config"
setx /M JUPYTER_CONFIG_PATH "%%JUPYTER_BASE%%\search"
setx /M JUPYTER_RUNTIME_DIR "%%JUPYTER_BASE%%\runtime"
setx /M JUPYTERLAB_WORKSPACES_DIR "%%JUPYTER_BASE%%\workspace"
pause
8. Setup Configuration
cd d:
jupyter-lab --generate-config
D:/Install/Dev/workspace/jupyter-module/config/jupyter_lab_config.py
vim jupyter_lab_config.py
c.ServerApp.root_dir = 'D:\\Install\\Dev\\workspace\\jupyter-module\\notebook'
c.ServerApp.browser = 'D:/Install/System/Firefox/firefox.exe http://127.0.0.1:12345/lab --app=%s'
c.ServerApp.ip = '*'
c.ServerApp.port = 12345
c.ServerApp.allow_origin = '*'
# 其它配置或环境变量可酌情修改
9. Launch JupyterLab
cd D:\Install\Dev\workspace\jupyter-module
jupyter-lab
复制token,如:8df31971fba74a75ed1b0679ed250cee5d292ebead751ec9
10. JupyterLab Verification
http://127.0.0.1:12345/lab
键入token并设置密码:elf
停止JupyterLab后,重新启动JupyterLab
http://127.0.0.1:12345/lab,输入密码elf登录后操作
11. Common Command
$ jupyter -h
$ jupyter --version
$ jupyter --paths
$ jupyter-lab -h
$ jupyter labextension --help
jupyter notebook --version && jupyter lab --version
12. Jupyter Rust
-
Visual Studio Build Tool和Windows SDK
-
安装时左边选择Desktop Dev with C++,
右边选择Windows SDK;并自定义路径;具体查看Graal安装章节;
# rustc 1.75.0
rustc --version
conda --version
cd D:\Install\Green\JupyterRust
conda create -n jupyter-rust python=3 -y
# conda deactivate
conda activate jupyter-rust
conda install -c anaconda cmake -y
# cargo install evcxr_jupyter
# 安装时需大点内存,否则Compiling和Building会失败
cargo install --locked evcxr_jupyter --force
evcxr_jupyter --install
# 重新构建jupyter lab
jupyter lab build
# 查看Jupyter Available Kernel List
juyter lab kernelspec list
13. Optional Command
# 因Conda Navigator可页面安装,故此选项可选
# conda install -c conda-forge jupyterlab -y
# Optional:注意版本适配,ValueError: The extension "jupyterlab-plotly"
# doesn't yet JupyterLab support current version
# https://github.com/jupyterlab/jupyterlab/issues/14590
# jupyter labextension install jupyterlab-plotly
# conda search nodejs
# conda uninstall nodejs
conda install -c conda-forge nodejs=18.18.2 -y
14. Rust Verification
-
打开Conda Navigator,启动Jupyter Lab,新建Rust Notebook
fn main(){
println!("Hello, world!");
}
main();
15. Jupyter Starter
echo off
cls
chcp 65001
set JUPYTER_URL=D:/Install/Dev/workspace/jupyter-module
d:
cd %JUPYTER_URL%
jupyter-lab