擅长:python、mysql、java
<p>这是因为<code>paquete</code>在您的<code>sys.path</code>中,但包的内部不是。因此,您可以为<code>paquete</code>包进行绝对导入,但只能为其内部进行相对导入。<code>paquete</code>在你身上<code>sys.path</code>因为它在同一个目录中,你呢主.py. 你知道吗</p>
<p>您可以在导入之前设置<code>__path__</code>属性,以获得import语句要考虑的包的内部信息。你知道吗</p>
<p>请看这个以供参考<a href="https://docs.python.org/3/reference/import.html#module-path" rel="nofollow noreferrer">https://docs.python.org/3/reference/import.html#module-path</a></p>