相关疑难解决方法(0)

等效于 `setup.py` 中的 `--find-links`

相当于in的--find-links/-f标志。pipsetup.py

我知道dependency_links存在,但这需要指向一个特定的文件,我想要类似的东西-f可以指向一个链接列表,可以根据版本和操作系统从中选择包。

python pip setuptools easy-install python-3.x

11
推荐指数
1
解决办法
2515
查看次数

pip:优先处理私有pypi服务器

我正在使用Artifactory托管大量python模块。几次,https: //pypi.python.org/pypi上的新python模块将以相同的名称上传。当有人尝试使用pip从Artifactory安装我的模块之一时,这会导致问题。默认情况下,pip首先查找公共软件包。

这是我尝试过的:

1.我尝试过相应地修改.pypirc文件,

[distutils]
索引服务器=
        人为的
        pi

带有两个索引服务器的适当条目,但是我相当确定pip会忽略此信息。

2.我尝试手动指定要使用的索引服务器。

我可以指定--index-url--extra-index-url但当公共软件包的版本号高于私有软件包的版本号时,后者不能提供帮助。如果我指定前者,则找不到公共依赖项!就像我赢不了。

3.我尝试dependency_links在setup.py中指定。

...但此答案已弃用:pip忽略setup.py中的dependency_links

我如何配置pip来选择我的Artifactory存储库而不是公共存储库?

python pip

10
推荐指数
2
解决办法
2033
查看次数

从dependency_links安装包的问题

这是我的setup.py:

    setup(
        ...
        install_requires=['GEDThriftStubs'],
        dependency_links=['git+ssh://user@git.server.com/ged-thrift-stubs.git#egg=GEDThriftStubs'],
...)
Run Code Online (Sandbox Code Playgroud)

然后我创建包:

python setup.py sdist
Run Code Online (Sandbox Code Playgroud)

然后我尝试安装它:

pip install file://path/package-0.0.1.tar.gz

在终端中获取此信息:

Downloading/unpacking GEDThriftStubs (from package==0.0.1)
  Could not find any downloads that satisfy the requirement GEDThriftStubs (from package==0.0.1)
No distributions at all found for GEDThriftStubs (from package==0.0.1)
Run Code Online (Sandbox Code Playgroud)

在像这样的pip.log消息中:

Skipping link git+ssh://user@git.server.com/ged-thrift-stubs.git#egg=GEDThriftStubs; wrong project name (not gedthriftstubs)
Run Code Online (Sandbox Code Playgroud)

如果重要的话,我的项目中没有任何名称为"gedthriftstubs"的名称.

但这很好用:

pip install git+ssh://user@git.server.com/ged-thrift-stubs.git#egg=GEDThriftStubs
Run Code Online (Sandbox Code Playgroud)

python pip setuptools

7
推荐指数
1
解决办法
1192
查看次数

在 setup.py 中为 PyPI 中的模块指定依赖 url

到目前为止,我在这里看到的问题处理相反的情况,即提供指向 off-PyPI 依赖项的链接。就我而言,依赖项是在 PyPI 中发布的,但版本不符合我的要求。这是我的摘录setup.py

setup(
    ...
    install_requires=["numpy>=1.11.0",
                      "scipy>=0.17.0",
                      "lasagne",
                      "Theano>=0.8.1",
                      "scipy>=0.17.0"],

    dependency_links=["git+https://github.com/Lasagne/Lasagne.git#egg=lasagne"]
)
Run Code Online (Sandbox Code Playgroud)

我需要lasagne从链接安装,同时pip坚持安装PyPI版本。

编辑。我试过这样做

setup(
    ...
    install_requires=["numpy>=1.11.0",
                      "scipy>=0.17.0",
                      "lasagne>=0.2.dev1",
                      "Theano>=0.8.1",
                      "scipy>=0.17.0"],

    dependency_links=[
        "git+https://github.com/Lasagne/Lasagne.git#egg=lasagne-0.2.dev1"]
)
Run Code Online (Sandbox Code Playgroud)

这导致 Could not find a version that satisfies the requirement lasagne>=0.2.dev1

编辑2

实际上通过此处--process-dependency-links所示的标志(感谢 Nehal J. Wani)使其工作。我怎样才能让这个标志默认工作?我不希望用户感到困惑。

python pip setuptools pypi setup.py

5
推荐指数
0
解决办法
1004
查看次数

将自定义转轮文件添加为setup.py中的依赖项?

我正在一个项目中,其中一个依赖项实际上是一个.whl不在pypi 上的依赖项(即,我必须直接从作者那里下载轮并直接pip安装它)。在我的setup.py文件中,有没有办法做类似的事情:

install_requires=[
    'library.whl',
    'matplotlib==2.2.2',
    'numpy==1.14.2',
    'opencv-python==3.4.0.12',
    'Pillow==5.1.0',
    'PyYAML==3.12',
],
Run Code Online (Sandbox Code Playgroud)

还是沿着这些路线,因为它不在pypi上(我只是将其添加library.whlMANIFEST.in文件中?)?如果没有,是否有针对这种情况的推荐方法?理想情况下,我想在setup.py文件中解决此问题,这样我就可以轻松安装一个库pip install

python pip setuptools

5
推荐指数
1
解决办法
1131
查看次数

setup.py忽略完整路径依赖性,而是在pypi中查找“最佳匹配”

类似于/sf/ask/876294961/

我正准备与验证器一起开放的PR,因此正在修改造假者,并且希望能够测试我将拥有的新依赖项。

setup(
    name='Faker',
    ...
    install_requires=[
        "python-dateutil>=2.4",
        "six>=1.10",
        "text-unidecode==1.2",
    ],
    tests_require=[
        "validators@https://github.com/kingbuzzman/validators/archive/0.13.0.tar.gz#egg=validators-0.13.0",  # TODO: this will change  # noqa
        "ukpostcodeparser>=1.1.1",
        ...
    ],
    ...
)
Run Code Online (Sandbox Code Playgroud)

python setup.py test 拒绝安装0.13.0版本。

如果我将故障线向上移动install_requires=[..](应该不存在)

setup(
    name='Faker',
    ...
    install_requires=[
        "python-dateutil>=2.4",
        "six>=1.10",
        "text-unidecode==1.2",
         "validators@https://github.com/kingbuzzman/validators/archive/0.13.0.tar.gz#egg=validators-0.13.0",  # TODO: this will change  # noqa
    ],
    tests_require=[
        "ukpostcodeparser>=1.1.1",
        ...
    ],
    ...
)
Run Code Online (Sandbox Code Playgroud)
  • 使用pip install -e .一切都很好-安装了正确的版本。
  • 使用python setup.py develop相同的问题。

My guess is setuptools/distutils doing something weird -- pip seems to …

python pip setuptools setup.py

5
推荐指数
1
解决办法
132
查看次数

标签 统计

pip ×6

python ×6

setuptools ×5

setup.py ×2

easy-install ×1

pypi ×1

python-3.x ×1