为什么这个包在python3中不起作用?

2024-04-24 06:31:10 发布

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

我很好奇,一个小的定制python包。你知道吗

如果我运行python2中从包导入并使用函数的python文件,一切都正常。如果我在python3中运行该文件,尽管它无法从包中导入函数。你知道吗

    from cust_package import this_function
ImportError: cannon import name 'this_function'

包中的函数似乎是python3兼容的,为了以防万一,我对它们使用了futurize。这个问题与包/python版本的某种标记有关吗?这个包很小,2个.py文件,每个文件有8个函数。你知道吗

谢谢你的帮助,谢谢!你知道吗


Tags: 文件函数namefromimport版本packagefunction
1条回答
网友
1楼 · 发布于 2024-04-24 06:31:10

The default dir() mechanism behaves differently with different types of objects, as it attempts to produce the most relevant, rather than complete, information.

Dir documentation

如果您想要所有可用的函数,则有可用的问题。 here

相关问题 更多 >