Skip to main content
 首页 » 编程设计

Python 库 (foundation\FormParameters.py) 错误

2025年05月04日8rubylouvre

我在 IDLE 中输入的第一行是

from foundation import FormParameters 

我得到这样的错误

>>> from foundation import FormParameters 
Traceback (most recent call last): 
  File "<pyshell#0>", line 1, in <module> 
    from foundation import FormParameters 
  File "C:\Python32\lib\foundation\FormParameters.py", line 19 
    con_str = StringIO() 
                       ^ 
TabError: inconsistent use of tabs and spaces in indentation 

因为它是标准库,我可以更改它吗?还是有其他办法??

请您参考如下方法:

As it is a standard library can i change it?

您可以只打开引用的文件(“C:\Python32\lib\foundation\FormParameters.py”)并对其进行编辑 - 在这种情况下,我建议用空格替换制表符,因为制表符和 python 是一个邪恶的组合。

正如其他一些人评论的那样,这不是标准库的一部分 - 但即使是,同样的规则也适用 - 找到该文件,你可以自由编辑它(你可能不应该,如果你打算使用未修改的标准库在其他机器上运行您的程序)。对于 C 扩展,此过程稍微复杂一些,因为您需要编译它们。