首页 > 解决方案 > Python3循环库导入(模块未定义)

问题描述

我正在构建一个 python 库,但似乎无法解决这个相当微不足道的导入错误。我的文件夹结构如下:

./examples/somecode.py
./library/code/specific/__init__.py and other files for this submodule

我的 somecode.py 看起来像

from library.code import specific
... do things with specific ...

我得到特定的未定义错误

但前提是我在示例文件夹中。有趣的是,如果我从 ./ 文件夹启动解释器,代码就可以工作。

我究竟做错了什么?

编辑:

该库是使用 python3 setup.py install 安装的

标签: python

解决方案


推荐阅读