【问题标题】:How to import code to ipython effectively from a github如何从 github 有效地将代码导入 ipython
【发布时间】:2013-12-05 00:34:32
【问题描述】:

所以我对编码和 python 比较陌生,我正在尝试按照 youtube 上的示例和教程来帮助我了解更多信息。目前我正在观看并关注本教程“Intro to scikit-learn

我已经访问了提供的 github(我不熟悉的其他东西)并尝试在 Ipython 中加载 github 文件的内容,但收效甚微。我想知道是否有人可以就如何执行此操作提供一些帮助或说明?

Here is a link 到有问题的 github。

【问题讨论】:

  • 1.你的代码是什么 2. 你想克隆 git 存储库,你想下载 master 分支的当前状态你想从 github 下载文件吗?
  • 在遵循示例的同时,我遇到了一些问题,让我的代码准确地重复视频的代码所实现的内容。所以我想如果我可以直接从 github 输入代码,我也许可以让它工作并找出我的尝试没有工作的原因。

标签: python python-2.7 github ipython scikit-learn


【解决方案1】:

以下近似场景:

In [1]: !git clone your_desired_project
In [2]: import sys
In [3]: sys.path.insert(0, '/path/to/folder')
In [4]: import desired_module

你可以代替In [2, 3]

In [2]: %cd /path/to/folder

【讨论】:

    【解决方案2】:

    您可以克隆 git 存储库并从 notebooks 文件夹中启动 IPython:

    git clone https://github.com/jakevdp/sklearn_scipy2013.git
    cd sklearn_scipy2013/notebooks
    ipython notebook
    

    【讨论】:

      猜你喜欢
      • 2011-06-07
      • 1970-01-01
      • 1970-01-01
      • 2020-01-10
      • 2013-07-24
      • 1970-01-01
      • 2019-08-12
      • 2014-10-10
      • 1970-01-01
      相关资源
      最近更新 更多