Sembra che nella tua mf3.py sei importing beyond the top level.
Supponiamo che la struttura del progetto è la seguente:
folder/
main.py
mod/
__init__.py
components/
__init__.py
expander.py
language_id.py
utilities/
__init__.py
functions.py
innanzitutto assicurarsi che
main.py si riferisce ai pacchetti secondari come:
from mod.components.expander import *
from mod.utilities.functions import *
expander.py e language_id.py avere accesso a functions.py con:
from ..utilities.functions import *
Aggiungi opzioni al vostro setup.py
È inoltre possibile utilizzare più py2exe options in modo che si stai importando tutti i moduli e i pacchetti richiesti dal tuo progetto. Per esempio.
# setup.py
from distutils.core import setup
import py2exe
setup(console=["script.py"],
options={
"py2exe":{
"optimize": 2,
"includes": ["mf1.py", "mf2.py", "mf3.py"], # List of all the modules you want to import
"packages": ["package1"] # List of the package you want to make sure that will be imported
}
}
)
In questo modo è possibile forzare l'importazione dello script mancante del progetto
bisogno di più informazioni, per esempio, le vostre strutture di file di progetto. Ma prova ad aggiungere il percorso py2exe al tuo PYTHONPATH? – BAE