首页 > 解决方案 > 你可以在 python 的子包中隐藏导入的模块吗?

问题描述

我的项目结构如下:

module/
  module.py
  /utils
    utils.py 

utils.py我导入类似的模块NumPy时,当我使用导入时utilsfrom utils import utils我不明白为什么它不公正import utils,如果有人能解释我会很高兴)我可以从with访问NumPy模块,有没有办法防止从子模块/子包中公开我的导入?utilsutils.numpy

标签: pythonpython-3.xpython-modulepython-packaging

解决方案


推荐阅读