我如何使用pip从git子目录安装? [英] How can I install from a git subdirectory with pip?

查看:429
本文介绍了我如何使用pip从git子目录安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a git repository with many folders, one of them being a python module installable with pip, like this:

repo.git /
repo.git / folder1 /
repo.git / folder2 /
repo.git / mymodule /
repo.git / mymodule / __ init__.py
repo.git / mymodule / setup.py
repo.git / mymodule / ...

repo.git/ repo.git/folder1/ repo.git/folder2/ repo.git/mymodule/ repo.git/mymodule/__init__.py repo.git/mymodule/setup.py repo.git/mymodule/...



<现在我必须做以下安装:

Right now I have to do the following to install:

git clone http://server/repo.git
cd repo
pip install mymodule
cd ..
rm -rf repo

是否可以直接使用pip直接安装模块而无需显式克隆?

Is it possible to install the module directly with pip without explicitly cloning ?

我试过了:

I tried:

pip install git+https://server/repo.git/mymodule/
pip install git+https://server/repo.git:mymodule/

但是我得到:

But I get:

IOError: [Errno 2] No such file or directory: '/tmp/pip-88tlLm-build/setup.py'


推荐答案

有关此功能的拉取请求,似乎已在一个月前合并为开发分支。语法是以下

There is a pull request regarding this feature, and it seems to have been merged to develop branch a month ago. The syntax is the following:

pip install -e git+https://git.repo/some_repo.git#egg=version_subpkg&subdirectory=repo # install a python package from a repo subdirectory

我们可能需要等待一段时间,直到它被合并到主数据库并分发。

We probably have to wait for a while until it gets merged to master and is distributed.

这篇关于我如何使用pip从git子目录安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆