为什么setuptools不理解git + https网址?

时间:2015-09-03 19:10:16

标签: python git setuptools

根据Dependency section in the setuptools manual git存储库,可以在dependency_links参数setup中使用git+URL指定存储库网址。然而,

cd /tmp
mkdir py-test
cd py-test
touch __init__.py

并使用

创建setup.py文件
from setuptools import setup, find_packages
from pkg_resources import parse_version

setup(
    name = "py-test",
    version = "1.0",
    packages = ["."],
    dependency_links = [
        "git+https://github.com/wxWidgets/wxPython.git"
    ],
    install_requires = ["wxPython"],
)
运行Download error on git+https://github.com/wxWidgets/wxPython.git: unknown url type: git+https -- Some packages may not be found!时,

会导致错误python setup.py build && sudo setup.py install

安装包python-setuptools-git无济于事。

我在Ubuntu 15.04上使用setuptools 18.2和python 2.7。

1 个答案:

答案 0 :(得分:9)

来自setuptools docs

  

对于VCS结帐,您还应附加#egg = project-version以确定应使用该结帐的包

所以修复只是将#egg=wxPython片段附加到结尾:

dependency_links = [
    "git+https://github.com/wxWidgets/wxPython.git#egg=wxPython"
]