python - 你可以在 python 的子包中隐藏导入的模块吗?
问题描述
我的项目结构如下:
module/
module.py
/utils
utils.py
在utils.py
我导入类似的模块NumPy
时,当我使用导入时utils
(from utils import utils
我不明白为什么它不公正import utils
,如果有人能解释我会很高兴)我可以从with访问NumPy
模块,有没有办法防止从子模块/子包中公开我的导入?utils
utils.numpy
解决方案
推荐阅读
- python - 如何将所有已安装在 Python 轮中的依赖项包含在内?
- python - 如何重塑数据以修复“RuntimeError:内核大小不能大于实际输入大小”
- python - 我试图用标题垂直打印 csv 数据,但它总是以水平线打印。有人可以看看我的代码吗
- symfony - Twig 变量在块外的扩展页面上不可用?
- django - 我们如何才能在 django-simple-history 中只保留删除操作
- python - dvc.api.read() 引发“UnicodeDecodeError”
- symfony - 使用 Symfony DateType 禁用未来日期
- ffmpeg - 有没有办法在ffmpeg中设置视频文件的整体比特率?
- python - Python 基类可以是没有 __mro_entries__ 的对象
- javascript - 如何获取对象中存在的对象?