简体   繁体   English

来自私人 github repo 的 pip install wheel 版本

[英]pip install wheel version from private github repo

I've packaged my private repo into a wheel.我已经将我的私人回购打包成一个轮子。 There are different versions of the wheel.有不同版本的轮子。 Is it possible to install a specific wheel version of the repo using pip from the command line and via the requirements.txt file?是否可以从命令行使用 pip 并通过 requirements.txt 文件安装特定版本的 repo? This feature isn't mentioned in the pip documentation from what I can tell.据我所知,pip 文档中没有提到此功能。

I can install a pip package from a private repository with no problem, using a Github token.我可以使用 Github 令牌从私有存储库毫无问题地安装 pip 包。

pip install git+https://$GITHUB_TOKEN@github.com/[username]/[reponame].git

I can also install a private pip package with a specific commit:我还可以安装一个带有特定提交的私有 pip 包:

pip install git+https://$GITHUB_TOKEN@github.com/[username]/[reponame].git@[commit_sha]

According to current docs, installing wheels (with or without pinned version) from VCS is currently not supported by pip, and maybe it never will.根据当前文档,pip 目前不支持从 VCS安装轮子(带或不带固定版本),也许永远不会。

I suspect the reason is that a wheel is basically a "compiled artifact", so you wouldn't usually find those committed into a git repository, eg all the examples from the VCS page show examples that would install that dependency from source and build it locally.我怀疑原因是轮子基本上是“已编译的工件”,因此您通常不会找到提交到 git 存储库中的那些,例如VCS 页面中的所有示例都显示了将从源代码安装该依赖项并构建它的示例本地。

如果要安装特定的轮子,请为 pip 提供该轮子的路径或 URL:

pip install https://example.com/url/of/wheel.whl

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

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