簡體   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