繁体   English   中英

如何从特定的GitHub HTTPS提交I​​D安装Python软件包

[英]How to install Python package from specific GitHub HTTPS commit ID

我有这样配置的Python包:

# setup.py
from setuptools import setup

setup(
    name='python-package-test',
    version='0.0.1',
    packages=['python-package-test'],

    dependency_links=[
        # This repo actually exists
        'git+https://github.com/nhooey/tendo.git@increase-version-0.2.9#egg=tendo',
    ],
    install_requires=[
        'tendo',
    ],
)

当我从setup.py安装此软件包时:

$ virtualenv --python=python3 .venv && \
    source .venv/bin/activate && \
    python setup.py install

$ pip freeze | grep tendo
tendo==0.2.9  # Note that this is the *correct* version

它会安装正确版本的tendo

但是,当我将此包上传到Git存储库并使用pip安装时:

# The GitHub link doesn't exist as it's private
# and it's different from the repo mentioned above
virtualenv --python=python3 .venv && \
    source .venv/bin/activate && \
    pip install git+ssh://git@github.com/nhooey/package.git

$ pip freeze | grep tendo
tendo==0.2.8  # Note that this is the *wrong* version

它安装了错误版本的tendo

为什么setup.py安装的行为不同于pip + git

与Pip一起安装时,必须使用--process-dependency-links选项,因为Pip不再自动处理它。

pip install --process-dependency-links 'git+ssh://git@github.com/nhooey/package.git'

您可能会认为Pip将显示警告,或者更新版本的setuptools也将忽略dependency_links

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM