rob*_*les 24 python distutils pip setuptools easy-install
这是一个类似的问题我如何让setuptools安装一个不在PyPI上的软件包?但不一样.
由于我想使用某些包的分叉版本,setuptools会忽略依赖关系链接(因为它具有相同的版本号).
有没有办法强制使用dependency_links中的链接?或者是更改分叉回购中版本号的唯一方法?
requires = [
...
'pyScss==1.1.3'
...
dependencies = [
'https://github.com/nadavshatz/pyScss/zipball/master#egg=pyScss-1.1.3'
]
Run Code Online (Sandbox Code Playgroud)
更新
奇怪的是,如果这个包是所需列表中唯一尚未安装的包,显然它可以工作.如果有另一个丢失的包,它将从pypi下载它.
小智 10
我相信您可以dependency_links按照该问题中的说明使用:
from setuptools import setup
setup(name = 'mypkg',
version = '0.0.1',
description = 'Foo',
author = 'bar',
author_email = 'bar@example.com',
install_requires = ['pyScss==1.1.3'],
dependency_links = [
'https://github.com/nadavshatz/pyScss/zipball/master#egg=pyScss-1.1.3'
]
)
Run Code Online (Sandbox Code Playgroud)
测试使用 python setup.py develop
您可能想要重命名鸡蛋以强调它是一个叉子http://www.python.org/dev/peps/pep-0386/
在setup.py之外,您可以使用requirements.txt和在本地强制执行此操作pip.虽然这不会使您的包依赖于fork,但您可以轻松地将其记录为安装方式.
$ cat requirements.txt
https://github.com/nadavshatz/pyScss/zipball/master#egg=pyScss-1.1.3
$ pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)
我最终做了一些非常类似于stackoverflow.com/a/17442663/368102中的答案.
我需要一个requests-file名称与requests-filePyPi中的不同包冲突的github包.它们都有1.0版本,PyPi版本有更高版本.
我的解决方法ias_tools/setup.py看起来像这样:
setup(
...
install_requires=[
'requests-file<=99.99',
],
dependency_links=[
'https://github.com/jvantuyl/requests-file/archive/b0a7b34af6e287e07a96bc7e89bac3bc855323ae.zip#egg=requests-file-99.99'
]
)
Run Code Online (Sandbox Code Playgroud)
在我的情况下,我正在使用pip所以我也必须使用--process-dependency-links:
% pip install --process-dependency-links ./ias_tools
You are using pip version 6.0.6, however version 6.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Processing ./ias_tools
DEPRECATION: Dependency Links processing has been deprecated and will be removed in a future release.
Collecting requests-file<=99.99 (from ias-tools==0.1)
Downloading https://github.com/jvantuyl/requests-file/archive/b0a7b34af6e287e07a96bc7e89bac3bc855323ae.zip
Requirement already satisfied (use --upgrade to upgrade): requests>=1.1.0 in ./venv/lib/python2.7/site-packages (from requests-file<=99.99->ias-tools==0.1)
Installing collected packages: ias-tools, requests-file
Running setup.py install for ias-tools
Running setup.py install for requests-file
Successfully installed ias-tools-0.1 requests-file-1.0
Run Code Online (Sandbox Code Playgroud)
我并不太担心弃用通知,因为拉取请求已提交给pip以弃用弃用(在讨论之后).
| 归档时间: |
|
| 查看次数: |
8304 次 |
| 最近记录: |