anaconda中jupyter修改默認地址、更改主題、配置頁面字體以及代碼自動補全


anaconda中jupyter修改默認地址、更改主題、配置頁面字體以及代碼自動補全

一、修改默認地址

Step1. 打開命令行窗口

  此步驟的操作有多種方式,列舉幾個常用的。

  • 第一種:開始界面 ---> Anaconda3(64bit) ---> 進入Powershell或者Prompt ---> 輸入conda activate 環境名進入要設置的環境

Powershell和Prompt基本上可以看作是一個東西,前者比后者的命令更加豐富。

圖片說明依次如下:
image

image

代碼(我自己的虛擬環境名稱是powerstation)

conda activate powerstation
  • 第二種:直接打開anaconda軟件 ---> 點擊Environment ---> 選擇目標環境 ---> 點擊三角符號 ---> 選擇第一個Open terminal

圖片說明依次如下:

image

image

image

image

image

Step2. 生成 Jupyter_notebook_config.py配置文件

jupyter notebook --generate-config

Step3 修改Jupyter_notebook_config.py文件

  Jupyter_notebook_config.py文件的路徑一般為C:\Users\17253.jupyter,17253是我自己的用戶名。

用記事本軟件打開文件,這里使用Windows自帶的記事本打開,點擊查找輸入c.NotebookApp.notebook_dir =' ',在單引號內加入要設置的路徑,注意一定要去掉#號,保存。

image

image

Step3. 更改屬性

  開始菜單 --->Jupyte Notebook(對應的環境名) ---> 鼠標右擊–更多–打開文件位置找到對應的Jupyte Notebook快捷圖標 ---> 鼠標右擊–屬性–目標 ---> 去掉后面的 “%USERPROFILE%/”,或者在去掉"%USERPROFILE%/"之后添加上自己的文件保存路徑(添加路徑時一定要與原先的有空格的距離,不然打開Jupyter Notebook會出錯) ---> 點擊“應用”,“確定”

image

image

image

二、更改主題

Step1.打開命令行窗口

  進入方法同上

Step2.安裝jupyter主題

pip install jupyterthemes

Step3 查看可用主題

image

Step4 配置主題

jt -t onedork -f fira -fs 13 -cellw 90% -ofs 11 -dfs 11 -T -T

-t 主題 -f(字體) -fs(字體大小) -cellw(占屏比或寬度) -ofs(輸出段的字號) -T(顯示工具欄) -T(顯示自己主機名)

主題風格(素材來自博客園百里希文

  1. chestersih

    jt -t chesterish -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
    

    image

  2. grade3

     jt -t grade3 -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
    

    image

  3. gruvobxd

     jt -t gruvboxd -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
    

    image

  4. gruvboxl

    jt -t gruvboxl -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
    

    image

  5. monokai

     jt -t monokai -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
    

    image

  6. oceans16

     jt -t oceans16 -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
    

    image

  7. onedork

     jt -t onedork -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
    

    image

  8. solarizedd

     jt -t solarizedd -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
    

    image

  9. solarizedl

    jt -t solarizedl -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
    

    image

恢復 Jupyter 默認風格

jt -r

設置代碼自動補全

Step1. 進入控制終端

  方法同上

Step2.安裝nbextensions

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user

Step3.安裝nbextensions_configurator

pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user

Step4.重啟jupyter頁面會增加一個Nbextensions標簽。

  進入這個選項,把左上角的對鈎點掉,然后勾選Hinterland即可。

image

image


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM