6

我想把 nbviewer 带到我的工作中。因为我无法共享公司数据(放在 github 上),我需要在本地安装 nbviewer。有在 Heroku 上设置的说明,但这对我不起作用。有没有人尝试过这个?甚至值得努力吗?还有其他选择吗?谢谢。

让 nbviewer 在本地计算机上运行的步骤:

Step1:从 github 下载 nbviewer
Step2:从 github下载 nbconvert
Step3:将 nbconvert 内容放入 nbviewer 内的“nbconvert”文件夹中

Step4:获取所需库
easy_install Flask==0.9
easy_install Flask-Markdown
easy_install 请求
easy_install Pygments (python xy自带)
easy_install Markdown==2.2.0
easy_install pylibmc==1.2.3
easy_install tornado
easy_install newrelic (安装可选c扩展失败但是认为这没问题)
easy_install pyzmq(带有python xy)

Step5:编辑 gist.py
注释掉所有这些行:

#from flask.ext.cache import Cache line 17   
#from lib.MemcachedMultipart import multipartmemecached line 20  
#cache = Cache(app, config=config) line 63  
#@cache.cached(5*hours) line 92  
#@cache.cached(5*hours) line 107  
#@cache.cached(5*hours) line 112  
#@cache.cached(5*hours) line 117  
#@cache.cached(5*hours) line 122  
#@cache.cached(5*hours) line 127  
#@cache.cached(1*minutes) line 133  
#@cache.memoize() line 177  
#@cache.memoize(10*minutes) line 201  

Step6:运行 app.py
Step7:到 localhost:5000

如何处理身份验证问题?(笔记本位于受密码保护的存储库中)
错误:请求失败:GET http svn/BizIntel/Trunk/notebook.ipynb:需要 401 授权

答案:http 用户名:password@svn/BizIntel/Trunk/notebook.ipynb

请享用!

4

1 回答 1

10

是的,nbviewer 可以安装在本地,这通常是我们开发它的方式。如果你想在你自己的机器上设置一个接近 heroku 的设置,你可以使用 heroku foreman 。

如果你想要一些简单的东西,只需克隆 nbviewer,安装依赖项requirements.txt并运行python app.py(可能是git update.

然后,您可以打开浏览器访问 localhost:5000,您应该在本地运行自己的 nbviewer 版本。

它不会消除通过本地 url 访问 ipynb 文件以使其工作的必要性,但如果它安装在公司防火墙后面,那应该不是问题。

如果需要,请随时在 github 上打开问题。

于 2013-05-07T08:51:11.057 回答