2015-01-14 42 views
1

我想爲Ipython筆記本使用另一個主題,所以我遵循此instructions問題是我在OSX中,我沒有wget,我安裝了它自制軟件。有人能幫我設置一個黑暗主題的ipython筆記本嗎?我試過這個:在Ipython中設置新主題時出現問題?

brew /Users/user/.ipython/profile_notebooks/static/custom/custom.css 
https://raw.githubusercontent.com/nsonnad/base16-ipython-notebook/master/base16-ocean-dark.css 

回答

5

你可以用curl或手動下載主題。我已經爲以下兩個選項提供了步驟。

ipython profile create ocean 

使用以下命令

使用curl替換默認樣式表custom.css的與所需主題的內容:

使用以下命令創建一個自定義配置文件

curl -o `ipython locate profile ocean`/static/custom/custom.css https://raw.githubusercontent.com/nsonnad/base16-ipython-notebook/master/base16-ocean-dark.css 

按規格啓動IPython筆記本找到自定義配置文件例如

ipython notebook --profile=ocean 

備選:

如果您無法使用curl下載,你可以簡單地下載base16-ocean-dark.css並在您創建的配置文件的自定義目錄更換custom.css

找到配置文件目錄:

ipython locate profile ocean 

轉到其static/custom目錄和替換的custom.css與下載css文件的內容。 通過指定如上所示的自定義配置文件啓動IPython筆記本。

3

Amit的回答不適合ipython=>4.0,因爲jupyter現在被分開。您可以嘗試jupyter-themes。 適用於ipython=>4.0,安裝簡便。

安裝jupyterthemes

$ pip install --upgrade jupyterthemes 

選擇一個主題,並安裝

# list themes (located in ~/.jupyter-themes) 
$ jt -l 

# install theme (-t) for jupyter nb 
# theme names: oceans16 | grade3 | space-legos 
$ jt -t grade3 

# install a theme (-t) with toolbar (-T) enabled 
$ jt -T -t grade3 

# install a theme (-t) and set font-size (-f), default value is 11 
$ jt -f 12 -t grade3 

# reset (-r) to default for jupyter theme 
$ jt -r 
+0

嘿,我做了你的建議,但得到一個問題「主題grade3找不到。可用:」和空列表如下,顯然。我查看了'jupyterthemes/__ init __。py',並且在get_theme()方法返回不包含grade3的主題列表時出現此錯誤。但說實話,我有一種感覺,它看起來在一個錯誤的目錄。與此同時,我無法從git安裝它,所以我從zip文件安裝它 - 不確定預計是否有任何區別。 – Ilya

+0

@llya在用戶主頁中是否有'.jupyter','.jupyter-themes'文件夾?並且在'.jupyter'下需要一個'custom'文件夾。 PS:我正在使用Windows,也許其他操作系統會有一些不同。 – Mithril

+0

我也在使用Windows。我只有'.jupyter'文件夾,一個文件'遷移'沒有擴展名。 – Ilya

1

我已經添加jupyterthemes的名義下jupyterthemes到的PyPI。

要安裝最新版本:

#uninstall any old versions 
pip uninstall jupyter-themes 
#install the latest version (no hyphen) 
pip install jupyterthemes 

希望這需要的人與主題沒有顯示出來(@llya)有任何問題,呵護。