一、chrome谷歌瀏覽器
1. 安裝
- 1.1 下載地址:
下載地址: https://www.google.cn/intl/zh-CN_ALL/chrome/fallback/
2 插件markdown-viewer
- 2.1 下載地址:
下載地址:https://github.com/simov/markdown-viewer/releases
- 2.2 設置(打開mermaid渲染)
- 【擴展程序】–>打開【開發者模式】
- 【詳情】–>【擴展程序選項】–>【Settings】打開:mermaid,mathjax
二、python安裝(構建綠色版):
-
下載地址:https://mirrors.huaweicloud.com/python/3.13.3/
-
安裝到 \path\to\Python3133
-
拷貝\path\to\Python3133 到\path\to\Python3133_bak
-
卸載python3.13.3
-
拷貝\path\to\Python3133_bak 到\path\to\Python3133
-
添加環境變量:\path\to\Python3133\Scripts和\path\to\Python3133到PATH
-
在\path\to\Python3133添加兩個文件python3.13.3.bat 和 python3133.bat,內容如下:
@echo off echo 原始命令:%~f0 %* echo 運行命令:%~d0%~p0python.exe %* %~d0%~p0python.exe %*
-
在\path\to\Python3133添加兩個文件python3.13.3.sh 和 python3133.sh,內容如下:
base_dir=$(cd $(dirname $0);pwd) echo 原始命令:$0 $* echo 運行命令:${base_dir}/python.exe $* ${base_dir}/python.exe $*
-
在\path\to\Python3133\Scripts添加兩個文件pip3.13.3.bat 和 pip3133.bat,內容如下:
@echo off echo 原始命令:%~f0 %* echo 運行命令:%~d0%~p0pip.exe %* %~d0%~p0pip.exe %*
-
在\path\to\Python3133\Scripts添加兩個文件pip3.13.3.sh 和 pip3133.sh,內容如下:
base_dir=$(cd $(dirname $0);pwd) echo 原始命令:$0 $* echo 運行命令:${base_dir}/pip.exe $* ${base_dir}/pip.exe $*
-
測試:
- 在cmd窗口中
python3.13.3 --version pip3133 --version
- 在gitbash窗口中
python3.13.3.sh --version pip3133.sh --version
- 在cmd窗口中
三、安裝jupyter
-
創建虛擬環境
- cmd窗口
mkdir .\my_jupyter cd .\my_jupyterpython3.13.3 -m venv jupyter_venv .\jupyter_venv\Scripts\activate pip install requests deactivate
- Git Bash窗口
cd path/to/your/project mkdir ./my_jupyter python3.13.3.sh -m venv jupyter_venvsource ./jupyter_venv/Scripts/activate pip install requests deactivate
- cmd窗口
-
安裝jupyterlab
- 相關網址:
- github
- 官網
- https://github.com/jupyter/jupyter-packaging
- 安裝:
pip install jupyterlab
- 相關網址:
-
漢化:
- 相關網址:
- https://github.com/jupyterlab/language-packs/releases
- 安裝:
pip install jupyterlab-language-pack-zh-CN
- 設置:
【Settings】–>【Language】–>【Chinese (simplified, China)】
- 相關網址:
-
插件:
-
相關網址:
- https://github.com/jupyter-lsp/jupyterlab-lsp
-
安裝:
pip install jupyterlab-lsp pip install python-lsp-server pip install "python-lsp-server[all]" pip install jupyterlab-spreadsheet-editor pip install jupyterlab-spreadsheet pip install jupyterlab_iframe pip install jupyterlab-code-formatter pip install jupyterlab_execute_time pip install bash_kernel pip install jupyterlab_myst pip install jupyterlab-latex
-
四、插件:
- 可以直接安裝的插件:
pip install json-lsp pip install yaml-lsp pip install jupyterlab_sql_editor[all] pip install sshkernel pip install jupyterlite-xeuspip install metakernel==0.25.* pip install python-language-server[all]
- 兩個相對成熟的官網插件:
- https://jupyterlab-contrib.github.io/extensions.html
- https://github.com/ml-tooling/best-of-jupyter#jupyterlab-extensions
- 插件管理
注意:如果沒有出現插件選項卡,可以通過 setting–>Advanced Settings Editor–Extension Manager :在User Overrides 添加語句{“enabled”: true},最后保存,就可以出現插件選項
當然,你也可以使用命令行方式進行插件的查看、安裝、更新和刪除查看已安裝插件:jupyter labextension list
更新已安裝插件:jupyter labextension update --all
安裝插件toc:jupyter labextension install @jupyterlab/toc
刪除插件toc:jupyter labextension uninstall @jupyterlab/toc
- 常用插件
# 大部分不適用于 jupyter-lab 4.4,止步于jupyter-lab 3.4
REM 安裝matplotlib 插件
pip install ipympl
pip install npm
pip install nodejs
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlibREM 安裝lsp插件
pip install jupyter-lsp
pip install python-lsp-server[all]
pip install python-language-server[all]
jupyter labextension install @krassowski/jupyterlab-lspREM 安裝code formatter 插件
pip install jupyterlab_code_formatter
jupyter labextension install @ryantam626/jupyterlab_code_formatter
pip install black isortREM jupyterlab-toc幫助我們在notebook界面利用markdown來創建目錄,輔助我們更好地整合梳理數據分析工作流
jupyter labextension install @jupyterlab/tocjupyter labextension install @jupyterlab/debugger-extensionREM 在jupyter lab中進行debug
jupyter labextension install @jupyterlab/debuggerREM jupyterlab-drawio是一個讓我們可以在jupyter lab界面內基于drawio繪制流程圖、思維導圖等示意圖的插件
jupyter labextension install jupyterlab-drawioREM jupyter-matplotlib幫助我們在notebook界面配合matplotlib實現交互式的作圖,只需要在繪圖之前執行魔法命令%matplotlib widget,之后繪制的所有matplotlib圖表即可自動轉換為交互式的
pip install ipympl
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlibREM jupyterlab-execute-time插件幫助我們在jupyter lab中記錄每個單元cell的執行開始以及運行耗時
jupyter labextension install jupyterlab-execute-timeREM jupyterlab-plotly是一款幫助plotly圖像在jupyter lab中正常渲染的插件
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidgetREM jupyterlab-spreadsheet幫助我們在jupyter lab中查看表格類文件,特別是其支持查看多工作表的excel表格文件
jupyter labextension install jupyterlab-spreadsheetREM jupyterlab-system-monitor通過在jupyter lab界面中添加資源監視器部件,能幫助我們在工作過程中方便的看到CPU、內存的實時占用情況:
pip install nbresuse
jupyter labextension install jupyterlab-topbar-extension jupyterlab-system-monitorREM 通過使用在JupyterLab中添加對markdown的其他渲染支持 markdown-it,以及以下內容 插件
pip install jupyterlab_markup
jupyter labextension install @agoose77/jupyterlab-markuppip install jupyterlab_latex
jupyter labextension install @mflevine/jupyterlab_html
pip install jupyterlab-dash
pip install jupyterlab-githubREM 該插件可以在Lab中展示plotly可視化效果。
pip install jupyterlab-fasta
pip install jupyterlab-geojson
pip install jupyterlab-katex
pip install jupyterlab-mathjax3
pip install jupyterlab-vega2
pip install jupyterlab-vega3
pip install jupyterlab-plotlyREM 該插件可以在Lab中展示bokeh可視化效果。
pip install jupyter_bokehREM 該插件可以在Lab中連接數據庫,并進行sql查詢和修改操作。會報錯:The extension "jupyterlab-sql" is outdated
REM pip install jupyterlab_sql
- 代碼自動提示完成
pip install jupyter-lsp
pip install python-lsp-server[all]
jupyter labextension install @krassowski/jupyterlab-lsp
五、安裝java內核:
- 安裝jdk(openjdk):
- 官網:
- https://openjdk.org/
- https://jdk.java.net/archive/
- https://adoptium.net/zh-CN/temurin/archive/?version=11
- 下載版本:(11 GA (build 11+28) Windows 64-bit)
- 地址:https://download.java.net/java/ga/jdk11/openjdk-11_windows-x64_bin.zip
- 安裝:
將openjdk-11_windows-x64_bin.zip解壓到指定目錄:/path/to
- 官網:
- 安裝ijava:
- 官網:https://github.com/SpencerPark/IJava/releases
- 解壓:ijava-1.3.0.zip到\my_jupyter\packages目錄下
- 安裝內核:
cd /path/to/my_jupyter/packages/ijava-1.3.0python install.py --prefix=/path/to/my_jupyter/jupyter_venvjupyter kernelspec list
- 修改配置文件:
- 文件:/path/to/my_jupyter\jupyter_venv\share\jupyter\kernels\java\kernel.json
- 修改:將java指定其絕對路徑(將\path\to換成自己的真實路徑)
- 內容示例如下:
{"argv": ["\\path\\to\\jdk-11\\bin\\java","-jar","\\path\\to\\my_jupyter\\jupyter_venv\\share\\jupyter\\kernels\\java/ijava-1.3.0.jar","{connection_file}"],"display_name": "Java","env": {},"interrupt_mode": "message","language": "java" }
六、配置
1. 生成配置文件
jupyter lab --generate-config
存放路徑:C:\Users%USERNAME%.jupyter\jupyter_lab_config.py
2. 生成并保存密碼:
python -c "from jupyter_server.auth import passwd;print(passwd())"
3. 修改配置文件:
然后修改生成的配置文件 C:\Users%USERNAME%.jupyter\jupyter_lab_config.py 就可以了
c.ServerApp.allow_remote_access = False
c.ServerApp.open_browser = True
c.ServerApp.browser = 'C:/Program Files/Google/Chrome/Application/chrome.exe --app=%s'
c.ServerApp.root_dir = "/path/to/my_jupyter/jupyter_data"c.ServerApp.ip = '0.0.0.0'
c.ServerApp.port = 8888c.PasswordIdentityProvider.hashed_password = "argon2:$arg********A"
c.PasswordIdentityProvider.password_required = True
4. 將配置文件移動到自己的my_jupyter目錄下
七、啟動
1. 命令行啟動
jupyter-lab --config=../jupyter_lab_config.py
\path\to\my_jupyter\jupyter_venv\Scripts\jupyter-lab.exe --config=\path\to\my_jupyter\jupyter_lab_config.py
2. 命令行指定root-dir
jupyter-lab --config=../jupyter_lab_config.py --notebook-dir=\path\to\my_jupyter\jupyter_data
\path\to\my_jupyter\jupyter_venv\Scripts\jupyter-lab.exe --config=\path\to\my_jupyter\jupyter_lab_config.py --notebook-dir=\path\to\my_jupyter\jupyter_data
2. 桌面快捷方式
- 2.1 創建jupyter-lab.exe快捷方式
- 2.2 修改啟動命令,添加參數: --config=\path\to\my_jupyter\jupyter_lab_config.py
- 2.3 下載一個jupyter-lab圖片,使用GIMP2導出為ico
- 2.4 修改快捷方式的圖標
3. 直接下載桌面應用
- https://github.com/jupyterlab/jupyterlab-desktop
八、conda包轉wheel包
pypi中無法安裝的包(需要本地編譯,例如y-py需要Rust語言環境),而conda中有編譯好的包,
但是不是wheel,需要轉換。所以本章節就處理這種包。
-
下載:
- 官網:
- 跳過注冊:【Skip registration】
-
設置國內源
# 清華源 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ #設置搜索時顯示通道地址 conda config --set show_channel_urls yes# 中科大鏡像源 conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/#設置搜索時顯示通道地址 conda config --set show_channel_urls yes
-
創建虛擬環境:
cd /path/to/ conda create --name conda_py312_venv python=3.12 conda create --name conda_py313_venv python=3.13conda activate conda_py313_venv conda env listconda install y-pyconda deactivate
-
打包環境:
conda install -c conda-forge conda-pack conda pack -n conda_py313_venv -o conda_py313_venv.tar.gz
-
下載conda包:
- 官網:https://anaconda.org/anaconda/y-py/files
-
將conda包轉為wheel包(以y-py為例)
- 下載對應的包:
- 官網:https://anaconda.org/anaconda/y-py/files
- 相應版本:win-64/y-py-0.6.2-py313h636fa0f_2.tar.bz2
- 下載:地址
- 解壓(Git Bash):
tar -xvjf y-py-0.6.2-py313h636fa0f_2.tar.bz2 cd ./Lib/site-packages
- 創建pyproject.toml文件
[build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta"[project] name = "y-py" version = "0.6.2"[tool.setuptools.packages.find] exclude = ["build"] [tool.setuptools.package-data] "*" = ["*.pyd"] "y_py" = ["*.pyd"]
- 打包為wheel
pip install build wheel python -m build python -m build --wheel pip install dist\y_py-0.6.2-py3-none-any.whl
- 安裝測試:
pip install dist\y_py-0.6.2-py3-none-any.whl
- 驗證:
import y_py as Y d1 = Y.YDoc() print(d1)
- 下載對應的包:
-
其他包(下面兩個包使用的是jupyter-lab3):
conda install conda-forge::jupyterlab-markup conda install conda-forge::jupyterlab-drawio
? 著作權歸作者所有