简体   繁体   English

如何在 pyscript 中从 Github repo 安装模块?

[英]How to install module from Github repo in pyscript?

I want to import module from github repo in my pyscript.我想在我的 pyscript 中从 github repo 导入模块。

From this command link -从这个命令链接 -

pip install --upgrade --no-cache-dir git+https://github.com/StreamAlpha/tvdatafeed.git

So that I can use this code in my pyscript code-这样我就可以在我的 pyscript 代码中使用这段代码-

from tvDatafeed import TvDatafeed, Interval

username = 'YourTradingViewUsername'
password = 'YourTradingViewPassword'

tv = TvDatafeed(username, password)

Check first if this is an import case issue, as reported i StreamAlpha/tvdatafeed issue 94 :首先检查这是否是导入案例问题,如我StreamAlpha/tvdatafeed问题 94中所报告的:

You can bypass pip by installing via Git using the second command under the installation section.您可以使用安装部分下的第二个命令通过 Git 安装来绕过pip
If you go this route, you'll need to change your import statement from using tvdatafeed to tvDatafeed如果您使用 go 这条路线,则需要将import语句从使用tvdatafeedtvDatafeed

edit:编辑:

 pip install --upgrade --no-cache-dir git+https://github.com/StreamAlpha/tvdatafeed.git

So in your case:所以在你的情况下:

from tvDatafeed import tvDatafeed, Interval
                       ^^^^^^^^^^

That's a good question.这是个好问题。 Feel free to track it under pyscript's github. I don't think that's possible because we're currently relying on Pyodide's packaging system and I don't know deep implementation details, but as far as I understand only pure python packages + whatever they ported manually currently works... I guess one thing you could do is manually create a package yourself.随意在 pyscript 的 github 下跟踪它。我认为这是不可能的,因为我们目前依赖 Pyodide 的打包系统,我不知道深入的实现细节,但据我所知,只有纯粹的 python 包+他们移植的任何东西当前手动工作...我想您可以做的一件事是自己手动创建一个 package。 Can I "fake" a package (or at least a module) in python for testing purposes? 我可以在 python 中“伪造”一个 package(或至少一个模块)用于测试目的吗? But.但。 It's a lot of work unfortunately: You can also reach out to the author and let them know it's not working on pypi and/or offer to maintain the package yourself!不幸的是,这是很多工作:您也可以联系作者,让他们知道它不能在 pypi 上工作和/或提供自己维护 package! Cheers and if still in doubt feel free to join pyscript channels: https://github.com/pyscript/pyscript-collective#resources干杯,如果仍有疑问,请随时加入 pyscript 频道: https://github.com/pyscript/pyscript-collective#resources

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM