如何从特定GitHub HTTPS提交ID安装Python包
我有一个Python包,配置如下:如何从特定GitHub HTTPS提交ID安装Python包,python,pip,Python,Pip,我有一个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/n
# 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安装时,您必须使用--进程依赖链接
选项,因为pip不再自动处理此操作
pip install --process-dependency-links 'git+ssh://git@github.com/nhooey/package.git'
您可能认为Pip会打印一条警告,或者更新版本的setuptools
也会忽略dependency\u链接