IPython與Jupyter notebook 安裝與配置,插件擴展,主題,PDF輸出


基於 python2.7.13 32-bit版本安裝

1、安裝pyreadline

https://pypi.python.org/pypi/pyreadline 

下載對應的32位版本

 安裝Microsoft Visual C++ Compiler for Python 2.7 並安裝

http://www.microsoft.com/en-us/download/details.aspx?id=44266

 

2、用pip安裝iPython

進入目錄 c:\Python27\Scripts>

輸入命令: pip install ipython

 

2.1 或者從git安裝iPython

https://github.com/ipython/ipython.git

把ipython.git pull 下來,checkout 到5.1分支(適用於Python2.7)。

使用cmd進入ipython目錄,輸入 python setup.py install 即可

 

檢查iPython是否安裝成功

命令行輸入 ipython 即可進入ipython

 

命令行輸入 ipython --pylab 

ipython會自動importSciPy,NumPy和matplotlib包,也就是不需要在命令輸入 from numpy import * 等命令

 

3、安裝notebook

pip install jupyter 

安裝成功后,命令行輸入:

jupyter notebook

 http://localhost:8888/ 檢查notebook服務器是否已經啟動

 

 4、查看已安裝的包

pip list

 

5、安裝擴展

https://github.com/ipython-contrib/jupyter_contrib_nbextensions

  安裝命令:

pip install jupyter_contrib_nbextensions

(或者用命令:pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master

jupyter contrib nbextension install --user

運行Jupyter Notebook, 在打開的Notebook界面里, 你會發現多了一個Nbextensions,勾選Table of Contents (有的版本是toc2). 然后創建或者打開一個Jupter Notebook

如果是anaconda,可以使用命令:

conda install -c conda-forge jupyter_contrib_nbextensions

 

5、安裝Jupyter themes

https://github.com/dunovank/jupyter-themes

安裝命令:

    pip install jupyterthemes

安裝完后,直接cmd下,使用 jt -l 查看所有 themes,使用 jt -t grade3 -T -N 啟用不同的themes。

重啟jupyter 生效

 

6、輸出PDF

 a、安裝pandoc

https://github.com/jgm/pandoc/releases/tag/1.19.2.1

 b、安裝MiKTeX

https://miktex.org/download

 c、安裝 GNU make for windows

http://gnuwin32.sourceforge.net/packages/make.htm

 d、把上面安裝好的軟件路徑,全部添加到環境變量里面

 e、PDF支持中文

 C:\Python27\Lib\site-packages\nbconvert\templates\latex\article.tplx

 把 \documentclass[11pt]{article} 修改為  \documentclass[11pt]{ctexart} 即可!!!

 

Pandoc 支持中文

pandoc infile.md -o outfile.pdf --latex-engine=xelatex -V mainfont="SimSun"


免責聲明!

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



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