简体   繁体   English

Pip仅安装纯Python软件包

[英]Pip install only pure-python packages

Is there a way to configure pip to install only pure-python packages with pure-python dependencies? 有没有一种方法可以将pip配置为仅安装具有纯python依赖项的纯python包? I'd like to be able to write a python project that is compatible with both Jython and CPython. 我希望能够编写一个与Jython和CPython都兼容的python项目。

Looking through the file that implements the various command line options for pip and reading the documentation, it would appear that none of these options have the ability to exclude packages based on this criterion. 浏览实现pip的各种命令行选项的文件并阅读文档,似乎这些选项都没有能力根据此标准排除软件包。 --no-binary and --only-binary seem to deal with compilation in general rather than excluding packages with non-python content. --no-binary--only-binary似乎通常处理编译,而不是排除具有非python内容的软件包。

https://github.com/pypa/pip/blob/de6e4b5c9ea942e6c961066f1ad7f5398b730dfa/pip/cmdoptions.py https://github.com/pypa/pip/blob/de6e4b5c9ea942e6c961066f1ad7f5398b730dfa/pip/cmdoptions.py

The python wheel PEP has metadata that shows what part of the package is a purelib and gets expanded into site-packages , and a Root-Is-Purelib boolean field which seems to indicate that the entire package is pure python. python wheel PEP具有元数据,该元数据显示软件包的哪个部分是purelib并被扩展为site-packages ,以及Root-Is-Purelib布尔值字段,该字段似乎表明整个软件包都是纯python。 https://www.python.org/dev/peps/pep-0491/ It might be possible to configure pip to exclude everything but wheels and then filter the wheels based on metadata. https://www.python.org/dev/peps/pep-0491/可能可以将pip配置为排除轮子以外的所有内容,然后根据元数据过滤轮子。

The deprecated --use-wheel flag seems to cause pip to prefer wheels, but not to exclude non-wheels. 不推荐使用的--use-wheel标志似乎导致pip偏爱车轮,但不排除非车轮。 There does not seem to be a way to block wheels from being installed based on their metadata. 似乎没有一种方法可以根据车轮的元数据阻止车轮安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM