我不明白这个...
我想安装这个 https://gist.github.com/sixtenbe/1178136 .
是python的峰值检测脚本。
我到处都被告知要使用带有 .git 扩展名的 pip。
我只看到如何下载 .zip,但从那里我迷路了。
如何安装?
谢谢。
请您参考如下方法:
让我们再看看它。
通过“安装包”,我们可能意味着该包应该可以通过import获得。 .
为此,包目录应位于当前目录或导入搜索路径中的其他目录之一。
一个这样的目录是 "user-specific site-packages directory, USER_SITE" :
python -c "import site; print(site.getusersitepackages())"
Git 网址
首先我们可能需要一个 Git URL。去https://gist.github.com/sixtenbe/1178136我们可以单击 Embed 弹出窗口并将其切换为 Clone via HTTPS:
为了获取GIT URL:https://gist.github.com/1178136.git .
git 和 bash
有了 Git URL 和 Unix shell (bash),我们可以手动将包安装到 USER_SITE。
让我们先进入 USER_SITE:
cd $(python -c "import site; print(site.getusersitepackages())")
pwd
现在我们在 USER_SITE 中,让我们下载 Gist:
git clone https://gist.github.com/1178136.git analytic_wfm
最后,让我们验证包现在是否可用:
cd && python -c "import analytic_wfm.analytic_wfm; print(analytic_wfm.analytic_wfm.__all__)"
如果安装了 numpy,它会打印
['ACV_A1', 'ACV_A2', 'ACV_A3', 'ACV_A4', 'ACV_A5', 'ACV_A6', 'ACV_A7', 'ACV_A8']
点数
让我们尝试使用 pip 安装 Gist 包。
对于 pip install,我们应该在 Git URL 前加上 git+:
pip install --user git+https://gist.github.com/1178136.git
这给了我们错误:
ERROR: git+https://gist.github.com/1178136.git does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
看起来我们选择的包缺少必要的 pip 配置!
让我们试试another one :
pip install --user git+https://gist.github.com/bf91613a021a536c7ce16cdba9168604.git
安装 NP:
Successfully built llog
Installing collected packages: llog
Successfully installed llog-1.0
特别是因为它有 setup.py .
另请注意,Gist 不支持子文件夹,pip 似乎依赖于它们来处理 packages参数,但是 setup.py 中的代码可以通过即时创建包子文件夹并将 Python 文件复制到那里来解决这个问题!
因此,如果您想导入 Gist,https://gist.github.com/sixtenbe/1178136 , 与其余的 requirements.txt依赖项,- 您可以fork 它并添加 setup.py 到 effect。
pypi
鉴于 analytic-wfm 也可以在 Python 包索引中找到,https://pypi.org/project/analytic-wfm/ , 你可以安装它
pip install analytic-wfm
