源自於http://chiamingyen.github.io/kmolsite/blog/leo-editor-jiao-xue-yi.html
Windows 環境 Python3 安裝
- 安裝 Python 3.4, 選擇不安裝 pip
- 利用 python get-pip.py, 安裝 pip
- 安裝 PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x64.exe https://www.riverbankcomputing.com/software/pyqt/download5
- 下載 Leo Editor 原始碼, https://github.com/leo-editor/leo-editor/releases/tag/broke-abbrev 利用 pip install broke-abbrev.zip 安裝 Leo Editor
可攜 Python3.4 設定
建立 data 目錄, 並在 data 目錄中建立 home, tmp, apps, Python34, SciTE 等子目錄, 其中 Python34 來自 C:\Python34, SciTE 也是安裝後直接複製到 data 目錄中.
將 lanuchLeo.py 存到 data/apps 目錄中, 用來啟動 Leo Editor
1 2 3 4 5 6 | """ Leo launcher script A minimal script to launch leo. """ import leo.core.runLeo leo.core.runLeo.run() |
啟動與關閉可攜系統的 start.bat 與 stop.bat 設定碼如下:
start.bat 設定
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 | @echo off REM 設定 V 硬碟代號與 data 目錄對應 set Disk=y subst %Disk%: "data" REM 設定 leo 相關對應 Home 位置 set HomePath=%Disk%:\home set HomeDrive=%Disk%:\home set Home=%Disk%:\home REM 設定 Leo 所用的編輯器 set LEO_EDITOR=%Disk%:\SciTE\SciTE.exe REM 將後續的指令執行, 以 %Disk% 為主 %Disk%: REM 設定 PYTHONPATH set PYTHONPATH=%Disk%:\Python34 REM Jupyter 設定 set JUPYTER_CONFIG_DIR=%Disk%:\home\.jupyter\profile_nbserver REM 設定 Jre 路徑, 特別注意 CLASSPATH 後的分號, 一定要有 set JAVA_HOME=%Disk%:\Java\jre1.8.0_51 set CLASSPATH=.; REM 設定 node.js 相關路徑 set NODE_PATH=%Disk%:\nodejs\node_modules\npm\node_modules;%Disk%:\nodejs\node_modules\npm set path1=%PATH%;%Disk%:\Python34;%Disk%:\Anaconda3\Scripts;%JAVA_HOME%\bin;%Disk%:\nodejs; set path2=%Disk%:\apps\Git\bin;%Disk%:\apps\pandoc;%Disk%:\apps\portableLatex\MiKTeX\texmf\miktex\bin; path=%path1%;%path2%; REM 啟動 SciTE start /MIN %Disk%:\SciTE\SciTE.exe REM 取 IPV4 IP address for /f "delims=[] tokens=2" %%a in ('ping -4 %computername% -n 1 ^| findstr "["') do (set thisip=%%a) REM echo %thisip% REM 取 IPV6 IP address REM for /f "delims=[] tokens=2" %%a in ('ping %computername% -n 1 ^| findstr "["') do (set thisip=%%a) REM echo %thisip% REM 啟動 Jupyter cd %Disk%:\tmp start %Disk%:\Python34\python.exe "%Disk%:\Python34\Scripts\jupyter-script.py" notebook --ip=%thisip% --certfile=%Disk%:\home\ssl_cert.pem --profile=nbserver cd .. REM 啟動 VMEmulator REM start %Disk%:\apps\nand2tetris\tools\VMEmulator.bat REM 啟動 Assembler REM start %Disk%:\apps\nand2tetris\tools\Assembler.bat REM 啟動 CPUEmulator REM start %Disk%:\apps\nand2tetris\tools\CPUEmulator.bat REM 啟動 HardwareSimulator REM start %Disk%:\apps\nand2tetris\tools\HardwareSimulator.bat REM 啟動 JackCompiler REM start %Disk%:\apps\nand2tetris\tools\JackCompiler.bat REM 啟動 TextComparer REM start %Disk%:\apps\nand2tetris\tools\TextComparer.bat REM 啟動 node.js REM 啟動 node.js REM start /MIN cmd.exe /k "%Disk%:\nodejs\nodejsvars.bat" REM start %Disk%:\nodejs\node.exe start /MIN cmd.exe start /MIN cmd.exe start /MIN cmd.exe REM 啟動 node.js REM start %Disk%:\IDE\nodejs\node.exe REM C:\WINDOWS\system32\cmd.exe /k %Disk%:\IDE\nodejs\nodejsvars.bat REM 啟動 Leo 編輯器 python.exe %Disk%:\apps\launchLeo.py Exit |
stop.bat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | @echo off set Disk=y REM 關閉 nginx REM taskkill /IM nginx.exe /F REM 關閉 SciTE taskkill /IM SciTE.exe /F REM 關閉 python taskkill /IM python.exe /F REM 清除 log 資料 path=%PATH%; REM del /Q /F Y:\tmp\*.* REM copy Y:\www\cmsimplexh_20130809\cmsimple\log_clean.txt V:\www\cmsimpleSpring2013\cmsimple\log.txt REM del /Q /F Y:\tmp\*.* REM 終止虛擬硬碟與目錄的對應 subst %Disk%: /D REM 關閉 cmd 指令視窗 taskkill /IM cmd.exe /F EXIT |
當然也可以直接下載以 Python 3.3 建立的 Windows 可攜式 Leo Editor: https://github.com/chiamingyen/portable_leoeditor
沒有留言:
張貼留言