如果它有多个子目录,如何从git安装pip包?

end*_*and 3 python pip python-2.7

我正在使用具有以下结构的仓库:

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

我试图使用以下内容安装此软件包:

pip install git+ssh://git@github.com/owner/repo-namegit@commithash#egg=mypackage&subdirectory=foo/bar
Run Code Online (Sandbox Code Playgroud)

但是,它只是挂在这里,似乎没有回应.

他们的文档没有像这样的多个嵌套目录包路径的示例.但它确实说,强调我的:

对于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'
Run Code Online (Sandbox Code Playgroud)

我看到这使用了我测试的所有版本的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
Run Code Online (Sandbox Code Playgroud)

它看起来像subdirectory我称之为的初始行之后,pip命令的那一部分正在消失?

end*_*and 8

当使用pip的多个运算符时,整个参数需要用引号括起来:

pip install git+ssh://git@github.com/owner/repo-name.git@commithash#"egg=mypackage&subdirectory=foo/bar"
Run Code Online (Sandbox Code Playgroud)

否则,pip会在&之后删除任何内容,并且无法成功识别此内容.

  • 快速说明:1)它是你的 shell 在 &amp;` 之后执行`drop任何东西,而不是 pip &amp; 2)你可以用引号(双引号或单引号)将 pip install 的整个参数括起来(即 `pip install "git+ssh:/ /git@github.com/owner/repo-namegit@commithash#egg=mypackage&amp;subdirectory=foo/bar"`)。 (4认同)