简体   繁体   English

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

[英]Why doesn't this package work in python3?

I'm curious, for a small custom python package. 我很好奇,对于一个小的自定义python包。

If I run the python file that imports and uses function from the package in python2, everything works fine. 如果我运行从python2包中导入并使用功能的python文件,则一切正常。 If I run the file in python3 though it fails importing functions from the package. 如果我在python3中运行文件,尽管它无法从包中导入函数。

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

The functions in the package seem to be python3 compatible, and I used futurize on them just in case. 软件包中的功能似乎与python3兼容,为了防止万一,我对它们使用了futurize。 Is the issue to do with some sort of labeling of the package/python version? 问题与软件包/ python版本的某种标记有关吗? The package is tiny, 2 .py files of ~8 functions each. 该软件包很小,每个有约8个功能的2个.py文件。

Appreciate the help, thanks! 感谢帮助,谢谢!

The default dir() mechanism behaves differently with different types of objects, as it attempts to produce the most relevant , rather than complete, information. 默认的dir()机制在尝试生成最相关的信息 (而不是完整的信息)时 ,对不同类型的对象的行为有所不同。

Dir documentation 目录文档

There are available questions if you want all the available functions. 如果需要所有可用功能,则存在可用问题。 here 这里

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

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