簡體   English   中英

如果它有多個子目錄,如何從git安裝pip包?

[英]How to install a package with pip from git if it has multiple subdirectories?

我正在使用具有以下結構的倉庫:

  • 富/酒吧/ setup.py
  • 富/酒吧/ mypackage的

我試圖使用以下內容安裝此軟件包:

pip install git+ssh://git@github.com/owner/repo-namegit@commithash#egg=mypackage&subdirectory=foo/bar

但是,它只是掛在這里,似乎沒有回應。

他們的文檔沒有像這樣的多個嵌套目錄包路徑的示例。 但它確實說,強調我的:

對於setup.py不在項目根目錄中的項目,使用“子目錄”組件。 “子目錄”組件的值應該是從項目的根目錄到setup.py所在的路徑

從多個目錄的pip正確形成的安裝是什么樣的?

以上是返回錯誤,例如:

  Could not find a tag or branch 'commit', assuming commit.
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: '/var/folders/wf/89r2567s5hv48lj1g9l65mbw0000gp/T/pip-gAwA3W-build/setup.py'

我看到這使用了我測試的所有版本的pip(9.0.1和8.1.1)。

這是詳細的日志:

$ pip install git+ssh://git@github.com/user/repo.git@hash#egg=projectname&subdirectory=lib/python
[1] 4195

Collecting projectname from git+ssh://git@github.com/user/repogit@hash#egg=projectname
  Cloning ssh://git@github.com/user/repo.git (to 8d109c760ae8a9599299924be1b78645e2617a50) to /private/var/folders/wf/89r2567s5hv48lj1g9l65mbw0000gp/T/pip-build-w01D4G/repo
  Could not find a tag or branch 'hash', assuming commit.
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: '/private/var/folders/wf/89r2567s5hv48lj1g9l65mbw0000gp/T/pip-build-w01D4G/repo/setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/wf/89r2567s5hv48lj1g9l65mbw0000gp/T/pip-build-w01D4G/repo/

[1]+  Exit 1                  pip install git+ssh://git@github.com/user/repo.git@hash#egg=projectname

看起來在我調用它的初始subdirectory行之后,pip命令的那一部分正在消失?

當使用pip的多個運算符時,整個參數需要用引號括起來:

pip install git+ssh://git@github.com/owner/repo-name.git@commithash#"egg=mypackage&subdirectory=foo/bar"

否則,pip會在&之后刪除任何內容,並且無法成功識別此內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM