jupyterlab 教學
環境介紹
功能介紹
起始畫面介紹
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 左上角的 “+” 為新增 Launcher
- 資料夾中包含一個+的圖示為新增資料夾
- 一個箭頭網上的圖示為上傳檔案
- – 何謂launcher
- – 中文名稱為啟動器,用於啟動使用者需要的服務,像是撰寫Python,R…等平台提供之語言。
分為 Notebook 和 Console 以及 Other 兩種介面可供撰寫程式使用。
編寫環境介紹
- Notebook:
- 筆記本形式寫code,適合完整的撰寫,例如作業、練習、上課筆記…等,在R裡面像是.Rmd。
環境教學如下圖
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 右上角圈起來的部分為使用的kernel,像是這張圖,就是說明正在使用python3的kernel
- 中間圈起來寫著code的部分,是提供使用者做型態轉換,型態分為Code,Markdown,Raw三種。
- – Code : 可以撰寫使用者所選kernel的語言,此處為python。
- – Markdown : 可以撰寫Markdown的語法,一種用於做筆記的語法。
- – Raw : 單純文字記錄,案執行後只會呈現原本文字。
自動補全
與大多數本地IDE 相同,輸入部分代碼之後按tab 鍵,即可自動補全。Jupyter Lab 中的自動補全顯示比之前Jupyter Notebook 的要友好,通過不同的顏色和圖標。顯示出了補全的類型。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
問號查看詳細文檔
在函數或變量等後面添加一個問號(?),執行之後,即可查看對應的詳細文檔:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- Console:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- Other:
- 此處有兩個功能,一個是terminal,另一個是Text Editor。
Step 1. 打開Text Editor 並寫入程式碼,這裡會發現檔名為.txt。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Step 2. 將檔案存檔後,更改名稱及副檔名。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
更改完成後,會發現文字變色,也更容易識別語法,建議同學們在使用的時候先將檔名及副檔名更改為你要編寫的程式。
執行中的程式
點選jupyterlab旁的 "Running"可以看到你正在執行的內容。
如果有沒在使用的內容,請終止它運作,沒關掉會佔用運算資源
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
簡單Linux教學
Linux簡介
- Linux
- 開放原始碼的OS
- 任何個人和機構都可以自由地使用 Linux 的所有底層原始碼,也可以自由地修改和再發布。
- 模仿Unixe
- 很多版本 Debian, Fedora, Red Hat(Centos)
- 適合伺服器使用
Linux的常用命令
- cd : change directory , R:setwd()
- ls : list file, R:ls()
- pwd : print working directory, R:getwd()
進入黑畫面 Terminal
介紹根目錄
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 進來terminal後可以看到 [~ mars]
- 使用者的名稱,這裡是mars
- 波浪符號~ 在linux系統中代表"用戶的根目錄"
何謂用戶的根目錄
- 請你們把它想成家的意思,然後一個家可以有很多個資料夾,所以你可以透過 cd ~ 快速回到根目錄進去其他資料夾。
ls 的用法
cd 的用法
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
pwd 的用法
- 這時候大家應該會想說,我如果開很多個資料夾,要怎麼知道我現在的位子在哪裡?
- 使用pwd可以得知目前的位置。當然jupyterlab的圖形化介面也會顯上,如下圖紅圈位置。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
為何pwd後會出現"/home/shaomin"這兩層,其實這兩層就是"~波浪符號"的絕對路徑。
絕對路徑 & 相對路徑
- 相對路徑 : 是相對於現在目錄的路徑表示,也就是你現在這個檔案在哪裡,這個目錄的路徑起始點就在哪裡。
- 絕對路徑 : 是一個絕對位置,他不會隨著檔案位置的變換而改變他的路徑。
假設今天地球是一個電腦,也是這台電腦的根目錄 “/home/earth”
[user@earth ~]$
地球裡面有七大洲,每個州是一個資料夾"/home/earth/state"
台灣屬於亞洲,高雄又屬於台灣,所以以上訴例子,高雄的絕對路徑就是"/home/earth/state/Asia/Taiwan/Kaohsiung"
想必各位都了解絕對路徑了
再講相對路徑前,先介紹路徑的幾個特殊符號
-「.」是代表目前所在目錄
-「..」是代表上層目錄,若目前已經是根目錄則依然為目前所在目錄
現在假設我的當前位置在台北,所以路徑如下
如果現在我在台北,我要去高雄,因為前面的路徑大致相同,所以這裡可以透過相對路徑的方式,更快地進入高雄這個資料夾,不需要把絕對路徑打出來
換句話說: 就是我如果在台北,要去高雄不用經過其他state,可以透過相對路徑過去。當然也可以從台北透過相對路徑去美國加州,但那個應該不是個好選擇。
練習
『同學練習把我們的"BBQ.ipynb"設定到對應的位址後,讀入此檔案』