如何建立标准图书馆

2024-04-25 20:31:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我想对python使用“kconfiglib”,但在执行时会得到一个“ImportError”。Kconfiglib附带了以下示例:

#! /bin/python
# Prints the names of all symbols that reference a particular symbol. (There's
# also a method get_selected_symbols() for determining just selection
# relations.)

import kconfiglib
import sys

conf = kconfiglib.Config(sys.argv[1])

x86 = conf["X86"]
for sym in conf:
    if x86 in sym.get_referenced_symbols():
        print sym.get_name()

运行此命令时,出现以下错误:

ImportError: no module named kconfiglib

所以我猜kconfig不是作为标准库安装的。但我怎样才能改变它呢?我在互联网上寻找一个解决方案,但他们大多是关于类似的图书馆,未能导入,他们的解决方案通常是安装一个新的“rpm”。不过,kconfiglib没有rpm。你知道吗

所以我需要一个解决方案来做到这一点的“硬代码”的方式。有人有主意吗?你知道吗

谢谢你的支持


Tags: inimportforgetconfsys解决方案x86