“from import"语句中的python点运算符

“from import

问题描述:

from . import _nd_image

我的问题是当前目录中没有这样的文件 _nd_image.py 并且代码使用上面的导入语句和下面的代码,在代码的某处有一个语句 _nd_image.fun().

My question is that there is no such file _nd_image.py in the current directory and code uses this above import statement and below, somewhere in code there is a statement _nd_image.fun().

如何导入目录中不存在的文件并使用它来调用某些函数.

How is it possible to import a file which is not present in the directory and use it to call some function.

代码取自这里>

import statement in at line no.36 

_nd_image 的用法在第 1 行.143

and usage of _nd_image is at line no. 143

目录中可能存在 _nd_image.pyd_nd_image.so 文件.这是一个用 C 语言编写的 Python 扩展库.这些文件充当可以导入的普通 Python 模块.请参阅此处此处 了解更多信息.

There is probably a file _nd_image.pyd or _nd_image.so in the directory. This is a Python extension library written in C. These files act as normal Python modules that can be imported. See here and here for more info.