[英]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.