保证python标准库的哪些部分可用? [英] Which parts of the python standard library are guaranteed to be available?

查看:114
本文介绍了保证python标准库的哪些部分可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想知道python标准库的哪些部分是绝对保证可用的,而哪些部分可能没有安装(取决于发行版).

I'm interested to know which parts of the python standard library are absolutely guaranteed to be available, and which parts might not be installed, dependent on distribution.

我见过这个问题,但是没有完全可以提供我要寻找的答案.

I've seen this question but it doesn't quite provide the answer I'm looking for.

我知道这些模块并非总是可用,并且数学模块始终为.其他模块呢?除了数学外,还有其他保证可用的模块吗?

I'm aware that these modules aren't always available and that the math module always is. How about other modules? Are there any modules besides math that are guaranteed to be available?

sys模块也始终可用.

推荐答案

如果您正在谈论标准的Python实现(CPython),则

If you are talking about the standard Python implementation (CPython), then the http://docs.python.org/3/library/index.html page lists the modules it provides (you can choose the Python version on the top of the page).

这些是Python实现中包含的标准模块,但是其中一些是特定于操作系统的,或者可能取决于其他平台组件.通常在具有这种依赖关系的模块的文档中对此进行说明.例如.: http://docs.python.org/3/library/posix.html –顶部有"Platform:POSIX"注释.

These are the standard modules included in the Python implementation, but some of them are operating-system specific or may depend on some other platform component. This is usually noted in the documentation of a module with such dependency. E.g.: http://docs.python.org/3/library/posix.html – there is „Platform: POSIX" annotation at the top.

其他依赖性可能不是那么明确– http://docs.python.org/3/library/sqlite3.html 并没有说只有在Python构建期间可以使用sqlite3时才构建此模块,但这是人们可以期待的.

Other dependencies may not be that explicit – http://docs.python.org/3/library/sqlite3.html doesn't say that this module is built only if the sqlite3 was available during Python build, but it is something one can expect.

无论如何,Python标准库参考始终是最好的起点.如果模块文档中没有提及平台,也没有任何建议表明它依赖于任何外部库或特定于平台的机制,那么您可以认为它是安全使用的.但是我们其他人曾说过-任何人都可以从自己的Python版本中删除任何内容.

Anyway, the Python Standard Library reference is always the best place to start. If a module documentation there doesn't say anything about platform and nothing suggests it depends on any external library or platform specific mechanism, then you may assume it is safe to use. But us other had said – anyone is free to remove anything from his Python build.

在任何Python安装中,非标准库中的所有内容都必须视为可选内容,但必须 http中的"pure python"模块与标准库中的某些二进制模块相比,://pypi.python.org/pypi 对于目标受众可能更有用.

Anything not from the Standard Library must be considered optional in any Python installation, but the 'pure python' modules from http://pypi.python.org/pypi may be more available for the target audience that some binary modules from the Standard Library.

这篇关于保证python标准库的哪些部分可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆