如何將 GitHub 儲存庫整合到'requirements.txt”中?

Barbara Streisand
發布: 2024-11-15 04:25:02
原創
340 人瀏覽過

How to Integrate GitHub Repositories into `requirements.txt`?

Specifying GitHub Source in requirements.txt

To integrate a library installed from a GitHub repository into your dependencies, modify your requirements.txt file as follows:

For GitHub repositories, omit the "package==version" naming convention. Instead, use the following format:

package-name @ git+git://github.com/owner/repo@reference
登入後複製

where "reference" can be:

  • Commit hash: package-name @ git+https://github.com/owner/repo@41b95ec
  • Branch name: package-name @ git+https://github.com/owner/repo@main
  • Tag: package-name @ git+https://github.com/owner/repo@0.1
  • Release: package-name @ git+https://github.com/owner/repo@releases/tag/v3.7.1

Example:

To update the "package-two" dependency with a GitHub repository, use one of the following configurations in your requirements.txt:

package-two @ git+https://github.com/owner/repo@41b95ec
package-two @ git+https://github.com/owner/repo@main
package-two @ git+https://github.com/owner/[email protected]
package-two @ git+https://github.com/owner/repo@releases/tag/v3.7.1
登入後複製

Note: In some pip versions, update the package version in the package's setup.py to avoid assuming the requirement is already met.

以上是如何將 GitHub 儲存庫整合到'requirements.txt”中?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板