从GitHub导入Python API时遇到问题

2024-06-02 09:58:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我正尝试在我的项目中使用此Python API: https://github.com/Rami114/Stockfighter

我一直在担心:没有模块名Stockfighter.Api文件你知道吗

我的文本编辑器是SublimiteText 3,我的代码如下所示:

from Stockfighter.Api import StockFighterApi

我还尝试使用sys导入它:

import sys
sys.path.append('/Users/myname/Desktop/PythonGames/Stockfighter-master/Stockfighter')

from Stockfighter.Api import StockFighterApi

我使用以下代码从终端中的github下载api:

$ python3 -m pip install git+https://github.com/Rami114/Stockfighter.git

这是安装的结果

Collecting git+https://github.com/Rami114/Stockfighter.git Cloning https://github.com/Rami114/Stockfighter.git to /var/folders/cg/2k70brh54y51hm65qh4dhwch0000gn/T/pip-w9ptx96u-build Requirement already satisfied (use --upgrade to upgrade): Stockfighter==0.1 from git+https://github.com/Rami114/Stockfighter.git in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/Stockfighter-0.1-py3.5.egg Requirement already satisfied (use --upgrade to upgrade): requests in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests-2.9.1-py3.5.egg (from Stockfighter==0.1) Requirement already satisfied (use --upgrade to upgrade): ws4py in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ws4py-0.3.4-py3.5.egg (from Stockfighter==0.1)

我对python和github都是新手,所以非常感谢您的帮助。谢谢您!你知道吗


Tags: tofromhttpsimportgitgithubcomapi