直接将github导入jupyter笔记本吗? [英] import a github into jupyter notebook directly?
问题描述
嘿,我正在创建一个jupyter笔记本,想安装:
Hey Im creating a jupyter notebook, would like to install:
https://github.com/voice32/stock_market_indicators/blob/master /indicators.py 这是一个python程序
https://github.com/voice32/stock_market_indicators/blob/master/indicators.py which is a python program
不确定如何直接执行操作,因此下载笔记本的任何人都可以单击全部运行",然后查看结果
not sure how to do it directly so anybody that dowloads the notebook can just hit "Run All", and see the results
选项1)进行如下操作: 来自 https://github.com/voice32/stock_market_indicators/blob/master/indicators .py 导入indicator.py
option 1) do something like: from https://github.com/voice32/stock_market_indicators/blob/master/indicators.py import indicators.py
这当然不起作用
谢谢!
推荐答案
您可以使用bash从jupyter笔记本中克隆存储库.在您的单元格中运行:
You can clone the repository from your jupyter notebook using bash. Run in your cell:
%%bash
git clone https://github.com/voice32/stock_market_indicators
这会将stock_market_indicators存储库克隆到您的目录中.
This will clone the stock_market_indicators repository to your directory.
您现在将可以访问indicator.py文件中的功能.您可以通过在jupyter中运行来导入它:
You will now be able to access the functions in your indicators.py file. You can import it by running in jupyter:
%load stock_market_indicators/indicators.py
这篇关于直接将github导入jupyter笔记本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!