小编GaT*_*aCa的帖子

从特定索引安装特定包

我构建了一个包(我们称之为mypackage),它依赖于 PyPi 上可用的知名第三方模块(即pandas)。我已将 mypackage 上传到自定义的类似 PyPi 的服务器 ( pypicustom ) 上。我正在努力将它安装在我只能访问 PyPi 镜像的环境中(我们称之为pypiproxy)。

pip install --index-url http://custompypi/ mypackage
Run Code Online (Sandbox Code Playgroud)

不起作用,因为显然找不到熊猫。

pip install --index-url http://pypiproxy/ --extra-index-url http://custompypi/ mypackage
Run Code Online (Sandbox Code Playgroud)

直到有人在 PyPi 上上传名为mypackage的包为止。

我能想到的最接近的是:

pip install --index-url http://custompypi/ --no-dependencies mypackage
pip install --index-url http://pypiproxy/ --extra-index-url http://custompypi/ mypackage
Run Code Online (Sandbox Code Playgroud)

这感觉不对。

任何想法?

python pip pypi

9
推荐指数
1
解决办法
3257
查看次数

Printf参数顺序被忽略

我正在运行以下代码片段:

#include <stdio.h>
int main() {
   printf("%f %d\n", 42, 3.14);
}
Run Code Online (Sandbox Code Playgroud)

令我惊讶的是,其中显示:

3.140000 42
Run Code Online (Sandbox Code Playgroud)

编译器(基于Debian的发行版上的gcc 8.3.0)确实警告我有关参数的顺序:

test.c: In function ‘main’:
test.c:3:13: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
printf("%f %d\n", 42, 3.14);
        ~^        ~~
        %d
test.c:3:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘double’ [-Wformat=]
printf("%f %d\n", 42, 3.14);
           ~^         ~~~~
           %f
Run Code Online (Sandbox Code Playgroud)

能比我更开明的灵魂向我解释这种行为吗?我在规范中没有发现任何可以解释的内容。

c printf gcc

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

Tox 支持的工具列表

我如何知道 tox 是否提供对特定工具的支持?

具体来说,我想知道为什么这个 tox.ini 部分适用于 flake8:

[flake8]
max-line-length = 120 # works like a charm

[testenv:flake8]
deps = flake8    
commands = flake8 mypackage/
Run Code Online (Sandbox Code Playgroud)

而这个不适用于 mypy:

[mypy]
ignore-missing-imports = True # won't be taken into account

[testenv:mypy]
deps = mypy
commands = mypy mypackage/
Run Code Online (Sandbox Code Playgroud)

python tox flake8 mypy

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

标签 统计

python ×2

c ×1

flake8 ×1

gcc ×1

mypy ×1

pip ×1

printf ×1

pypi ×1

tox ×1