使用pip requirements从git子目录安装

6
我在git中有以下结构。
scripts/
scripts/folder1/
scripts/folder1/module
scripts/folder1/module/setup.py
scripts/folder1/module/src/module
scripts/folder1/module/src/module/__init__.py
scripts/folder1/module/src/module/source.py

我想安装模块,所以我在我的requirements.txt文件中尝试了以下内容:

git+https://user@bitbucket.org/repo-name/scripts.git#egg=module&subdirectory=module 

但是这似乎不起作用,我遇到了以下错误:
IOError: [Errno 2] No such file or directory: '/private/var/folders/p_/gz96g4610fn94hz6w_l2gjyw0000gn/T/pip-build-MLhekq/module/module/setup.py

我知道这个问题可能已经在如何使用pip从git子目录安装中得到解答,但是我在寻找适用于我的情况的确切语法。

1个回答

12

好的,我刚刚想通了这个问题。对于任何可能会花费数小时在这上面的人

git+https://user@bitbucket.org/repo-name/scripts.git#subdirectory=folder1/module

3
那个 egg 名字怎么样?#egg=mypackage - tarabyte
如果您在Windows的cmd.exe上,您需要使用^符号转义&。像这样:pip install git+https://user@bitbucket.org/repo-name/scripts.git#egg=my_package^&subdirectory=folder1/module - ereOn
提示给其他人:你必须使用git+https,git+git是不行的,否则会得到以下错误信息:fatal: remote error: Repository not found.这可能是因为它无法正确解析“query”字符串。我刚刚记录了此问题:https://github.com/pypa/pip/issues/4898 - amohr

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接