尝试pip安装repo的特定分支.谷歌告诉我
pip install git + https://github.com/user/repo.git@branch
这个分支的名字是issue/34/oscar-0.6我做的,pip install https://github.com/tangentlabs/django-oscar-paypal.git@/issue/34/oscar-0.6但它返回404.
我该如何安装这个分支?
这是一个类似的问题我如何让setuptools安装一个不在PyPI上的软件包?但不一样.
由于我想使用某些包的分叉版本,setuptools会忽略依赖关系链接(因为它具有相同的版本号).
有没有办法强制使用dependency_links中的链接?或者是更改分叉回购中版本号的唯一方法?
requires = [
...
'pyScss==1.1.3'
...
dependencies = [
'https://github.com/nadavshatz/pyScss/zipball/master#egg=pyScss-1.1.3'
]
Run Code Online (Sandbox Code Playgroud)
更新
奇怪的是,如果这个包是所需列表中唯一尚未安装的包,显然它可以工作.如果有另一个丢失的包,它将从pypi下载它.
当用户发出安装原始软件的命令时,我想在pit上安装我在GitHub上的依赖项,也可以从GitHub上的源代码安装.这些软件包都不在PyPi上(永远不会).
用户发出命令:
pip -e git+https://github.com/Lewisham/cvsanaly@develop#egg=cvsanaly
Run Code Online (Sandbox Code Playgroud)
这个repo有一个requirements.txt文件,另一个依赖于GitHub:
-e git+https://github.com/Lewisham/repositoryhandler#egg=repositoryhandler
Run Code Online (Sandbox Code Playgroud)
我想是一个命令,一个用户可以发出来安装原包,有点子找到要求的文件,然后安装依赖了.
我一直在尝试安装配置了以下设置的软件包:
setup(
packages=find_packages(),
include_package_data=True,
install_requires=[
'Django==1.5.1',
'xhtml2pdf',
],
dependency_links=[
'https://github.com/chrisglass/xhtml2pdf/zipball/28d12fcaafc4c47b13f1f6f42c2bfb73f90cc947#egg=xhtml2pdf',
],
)
Run Code Online (Sandbox Code Playgroud)
但是它会从PyPi安装XHTML2PDF包,而不是使用指定的链接.根据输出(我运行安装使用pip install -vvv package.tar.gz),它可能无法从链接解析版本(// 1在代码中),或者我没有指定正确的项目名称(// 2在代码中):
Downloading/unpacking xhtml2pdf (from mypackage==1.3)
Getting page https://pypi.python.org/simple/xhtml2pdf/
URLs to search for versions for xhtml2pdf (from mypackage==1.3):
* https://pypi.python.org/simple/xhtml2pdf/
* https://github.com/chrisglass/xhtml2pdf/zipball/28d12fcaafc4c47b13f1f6f42c2bfb73f90cc947#egg=xhtml2pdf
Getting page https://github.com/chrisglass/xhtml2pdf/zipball/28d12fcaafc4c47b13f1f6f42c2bfb73f90cc947
Analyzing links from page https://pypi.python.org/simple/xhtml2pdf/
Found link https://pypi.python.org/packages/source/x/xhtml2pdf/xhtml2pdf-0.0.1.tar.gz#md5=9f83a2bcb67858aca9e058761f3bea7b (from https://pypi.python.org/simple/xhtml2pdf/), version: 0.0.1
Found link https://pypi.python.org/packages/source/x/xhtml2pdf/xhtml2pdf-0.0.2.tar.gz#md5=d640ccb9470942fd2e6d3ae740c27dc1 (from https://pypi.python.org/simple/xhtml2pdf/), version: 0.0.2
Found link https://pypi.python.org/packages/source/x/xhtml2pdf/xhtml2pdf-0.0.1.zip#md5=4ad41c845735ae14da99085311d84c00 (from https://pypi.python.org/simple/xhtml2pdf/), version: 0.0.1
Found link https://pypi.python.org/packages/source/x/xhtml2pdf/xhtml2pdf-0.0.4.zip#md5=5f035cd6532bef99b7d35054caaa6ef7 (from https://pypi.python.org/simple/xhtml2pdf/), version: 0.0.4 …Run Code Online (Sandbox Code Playgroud) 是否可以创建一个setup.py文件:
我正在设置一个django软件包/应用程序,它使用github上提供的第三方JavaScript框架.我希望能够让setup.py从github中提取最新版本,然后将这些文件放入相应的static/js文件夹中.因此,这与具有自己的setup.py文件的Python包的普通依赖项不同.
我正在运行本地pypi 服务器。-i我可以通过使用命令选项指定pip或设置PIP_INDEX_URL环境变量来从该服务器安装软件包。当我安装具有先决条件的软件包时,setup.py历史上已遵守PIP_INDEX_URL环境变量,从本地服务器中提取其他软件包。
然而,在最近安装的几个系统上,它的行为有所不同。例如,运行python setup.py develop失败,因为它尝试从pypi.python.org安装先决条件包。
我已经更新了我正在测试的所有系统上的所有相关 python 包(python、distribute、virtualenv、等...),并继续看到这种差异。pip在我的“原始”系统上,setup.py从环境变量中指定的 pypi 服务器下载先决条件PIP_INDEX_URL。在较新的系统上,我似乎无法让它尊重这个变量。
我缺少什么?
从我的setup.py:
requirements = [
...,
'git+https://github.com/SergeySatskiy/cdm-pythonparser/archive/v2.0.1.tar.gz'
]
setup(
install_requires=requirements,
...,
)
Run Code Online (Sandbox Code Playgroud)
这是行不通的。但是,我知道我可以使用简单的方式安装 tar.gz
pip install git+https://github.com/SergeySatskiy/cdm-pythonparser/archive/v2.0.1.tar.gz
Run Code Online (Sandbox Code Playgroud)
有没有办法在我的文件中进行设置setup.py?
我尝试过将其拉到本地,但效果不佳。
也尝试在没有 的情况下做到这一点git+,也没有成功。
我看到的是,我可以将依赖项添加到 kwarg 中,dependency_links如下所示:
setup(
...
install_requires=requirements,
dependency_links = ['http://github.com/SergeySatskiy/cdm-pythonparser/archive/v2.0.1.tar.gz']
)
Run Code Online (Sandbox Code Playgroud)
但它总是被包含在内。我想要完成的是将其包含在测试环境中。所以我将它添加到 中tests_require,但是当然这就像这样,install_requires所以没有帮助。
有没有办法只在我的测试环境中得到这个?
任何帮助表示赞赏!
我找到了一些与dependency_links相关的答案,但不幸的是它们还没有为我工作。我正在写一个 python 模块。它存储在私有 pypi 存储库中,并依赖于存储在同一私有存储库和公共 pypi 存储库中的一些依赖项:
setup(
# some other setup
name = 'mymodule',
install_requires = [
'kazoo',
'privateDependencyA',
'privateDependencyB'
],
dependency_links = [
"http://my.private.repo/eggs/#privateDependencyA",
"http://my.private.repo/eggs/#privateDependencyB"
])
Run Code Online (Sandbox Code Playgroud)
我存储mymodule在我的私人存储库中,因此我尝试安装它:
pip install -i http://my.private.repo/eggs/ mymodule
Run Code Online (Sandbox Code Playgroud)
这工作得很好,但找不到kazoo,这是一个公共图书馆。因此我尝试使用该-f标志:
$ pip install -i http://my.private.repo/eggs/ -f http://pypi.python.org/ mymodule
Downloading/unpacking mymodule
Downloading mymoudle-<version>.tar.gz (unknown size): 3.1kB downloaded
Running setup.py egg_info for package mymodule
Downloading/unpacking kazoo (from mymodule)
Could not find any downloads that satisfy the requirement …Run Code Online (Sandbox Code Playgroud) 我想知道是否有可能在Google Dataflow中运行自定义的Apache Beam Python版本。公共存储库中不可用的版本(撰写本文时:0.6.0和2.0.0)。例如,来自Apache Beam官方存储库的HEAD版本,或与此相关的特定标签。
我知道有可能按照官方文档中所述打包自定义软件包(例如,本地私有软件包)。这里回答了有关如何对其他一些脚本执行此操作的问题。甚至还有GIST 对此进行指导。
但是我没有设法获得当前的Apache Beam开发版本(或带标签的版本),该版本可在其官方存储库的master分支中获得,并打包并通过脚本发送到Google Dataflow。例如,对于最新的可用标签,PiP要处理的链接为:git+https://github.com/apache/beam.git@v2.1.0-RC2#egg=apache_beam[gcp]&subdirectory=sdks/python我得到如下信息:
INFO:root:Executing command: ['.../bin/python', '-m', 'pip', 'install', '--download', '/var/folders/nw/m_035l9d7f1dvdbd7rr271tcqkj80c/T/tmpJhCkp8', 'apache-beam==2.1.0', '--no-binary', ':all:', '--no-deps']
DEPRECATION: pip install --download has been deprecated and will be removed in the future. Pip now has a download command that should be used instead.
Collecting apache-beam==2.1.0
Could not find a version that satisfies the requirement apache-beam==2.1.0 (from versions: 0.6.0, 2.0.0)
No matching distribution found for apache-beam==2.1.0
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?(我想知道是否有可能,因为Google Dataflow可能已经修复了可以运行到官方发布版本的Apache Beam版本)。
根据我的研究,以下应该有效:
from setuptools import setup
from setuptools import find_packages
...
REQUIRES_INSTALL = [
'spacy==2.3.2',
'tensorflow==1.14.0',
'Keras==2.2.4',
'keras-contrib@git+https://github.com/keras-team/keras-contrib.git#egg=keras-contrib',
'en-core-web-sm@https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.0/en_core_web_sm-2.3.0.tar.gz#egg=en-core-web-sm'
]
...
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
install_requires=REQUIRES_INSTALL,
...
)
Run Code Online (Sandbox Code Playgroud)
当建造轮子或鸡蛋时,一切都很好:python setup.py bdist_wheel。
但是当尝试使用pip install -U dist/mypack-....whl.
我得到:
ERROR: Could not find a version that satisfies the requirement keras-contrib (from mypack==0.3.5) (from versions: none)
ERROR: No matching distribution found for keras-contrib (from mypack==0.3.5)
...
ERROR: Could not find a version that satisfies the requirement en-core-web-sm (from mypack==0.3.5) (from versions: …Run Code Online (Sandbox Code Playgroud) python ×10
pip ×5
setuptools ×5
git ×2
pypi ×2
setup.py ×2
apache-beam ×1
dependencies ×1
distribute ×1
distutils ×1
django ×1
easy-install ×1
github ×1