特定的GIT应用程序作为PIP包安装要求

sta*_*dev 8 git django packaging pip

我有这个应用程序https://github.com/staticdev/django-crud-utils需要安装django-sorting才能工作.但它不能是原来的django-sorting,而是我做的一个分支:https://github.com/staticdev/django-sorting

如何将其放在setup.py文件中进行打包?

韩国社交协会.

Yuv*_*dam 7

将其作为可编辑的要求包含在内,并注意您必须明确提及鸡蛋名称:

-e git+https://github.com/staticdev/django-sorting#egg=django-sorting
Run Code Online (Sandbox Code Playgroud)

有关更多选项,请参阅http://www.pip-installer.org/en/latest/requirements.html

  • 这在`install_requires`中不起作用 (8认同)

Hug*_*res 7

编辑setup.py并添加条目dependency_links:

dependency_links = [
    'https://github.com/staticdev/django-sorting/tarball/master#egg=django-sort',
],
Run Code Online (Sandbox Code Playgroud)

虽然你install_requires有类似的东西:

install_requires=[
    'Django>=1.3.1',
    'django-pagination>=1.0.7',
    'django-sort',
],
Run Code Online (Sandbox Code Playgroud)

如果您想使用需求文件,请遵循Yuval Adam的建议.

  • `install_requires`只接受"package> = version","package == version","package <= version"等字符串.例如,你不能在`install_requires`中使用`-e`. (3认同)