“from import"语句中的python点运算符 [英] python dot operator in 'from import' statement

查看:46
本文介绍了“from import"语句中的python点运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

这篇关于“from import"语句中的python点运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆