如何在 Jupyter Notebooks 中使用 Github 包

How to use Github Package in Jupyter Notebooks

我正在尝试在我的 jupyter 笔记本中使用 [此处] (https://github.com/dinkelk/PyDyGraphs) 中的 dygraphs 绘图函数。文档说:

Installation

Simply clone this repository and include the dygraphs.graph module in >>your Jupyter Notebooks. Note: PyDyGraphs only supports Python 3.

文档说要使用 "import dygraphs.graph as dy"

下载后,我不确定将存储库放在哪里。

我下载并解压的包。我在我的笔记本中加入了 "import dygraphs.graph"。

此包需要 pandas 安装和导入,我已经完成了。

import numpy as np
import dygraphs.graph as dy

_____
ModuleNotFoundError                       Traceback (most recent  
call last)
<ipython-input-3-29a3c1e17595> in <module>
      4 import pandas as pd
      5 import time
 ----> 6 import dygraphs.graph as dy

ModuleNotFoundError: No module named 'dygraphs'
_____

我想知道我应该把从 github 下载的文件放在哪里,如果还有什么我应该做的才能使用这个包。

使用"import dygraphs.graph"前需要添加系统路径(或将包安装到默认的python库)。参见 example .

在你的 jupyter notebook 中添加这样的东西:

       sys.path.append("../")

然后将“../”更改为您下载的 "dygraphs" 文件夹的相对路径。