[英]How to install Python package from specific GitHub HTTPS commit ID
I have a Python package configured like this: 我有这样配置的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',
],
)
When I install this package from setup.py
: 当我从
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
It installs the correct version of tendo
. 它会安装正确版本的
tendo
。
However, when I upload this package in a Git repository and install it with pip
: 但是,当我将此包上传到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
It installs the wrong version of tendo
. 它安装了错误版本的
tendo
。
Why is the setup.py
installation behaving differently from pip
+ git
? 为什么
setup.py
安装的行为不同于pip
+ git
?
You must use the --process-dependency-links
option when installing with Pip, since Pip no longer processes this automatically. 与Pip一起安装时,必须使用
--process-dependency-links
选项,因为Pip不再自动处理它。
pip install --process-dependency-links 'git+ssh://git@github.com/nhooey/package.git'
You'd think Pip would print a warning, or the updated version of setuptools
would also ignore dependency_links
as well. 您可能会认为Pip将显示警告,或者更新版本的
setuptools
也将忽略dependency_links
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.