Python Module Imports - Explicit vs Implicit Relative Imports

三世轮回 提交于 2019-12-05 00:13:24

Well, according to PEP-8 imports section:

Implicit relative imports should never be used and have been removed in Python 3.

As Python 3.3 is the one causing you trouble, making you explicit import relatives modules, I assume this explains the situation. It's probably that on Mac you have Python 2.x, that's why it works there.

Looking at your project's file distribution, Settings.py and MongoProvider are indeed relative modules. This means that the removal of implicit relative imports in Python 3 is the one causing you trouble, because the import system is unable to find the module:

ImportError: No module named 'MongoProvider'

It seems that the Python Version on your mac is 2.x while the Python on your windows is 3.x.

I have met the same problem before using module tkinter (which is Tkinter in Python 2.x).

It seems that we need to use from XXX.xxx import xxx to import...●﹏●

I don't know why, maybe it's the designer's adjusting to Python.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!