hola tengo el mismo problema, genero el ejecutable con cx_freeze, me da un problema con la libreria Numpy pero en realidad no la uso, a no ser que folium u otra libreria la use. Cree el archivo setup de la siguiente forma:
from cx_Freeze import setup, Executable
options = {
'build_exe': {
'packages': ['numpy'], # Lista de paquetes que quieres incluir
'includes': ['numpy'], # Lista de módulos que quieres incluir
}
}
executables = [
Executable('main.py', targetName='main.exe') # Nombre de tu script principal y nombre del ejecutable
]
setup(
name='Centro de Monitoreo',
version='1.0',
description='Descripción del proyecto',
options=options,
executables=executables
)
y ejecuto la compilacion asi: python setup.py build
me crea la carpeta build dentro de mi proyecto y cuando ejecuto ya en modo grafico con doble click o desde el CMD me sigue dando el siguiente error:
\Ejemplos Python\CMC\build\exe.win-amd64-3.11>main
Traceback (most recent call last):
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\multiarray.py", line 10, in <module>
from . import overrides
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\overrides.py", line 8, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: No se puede encontrar el módulo especificado.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\__init__.py", line 144, in <module>
from numpy.__config__ import show as show_config
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\__config__.py", line 4, in <module>
from numpy.core._multiarray_umath import (
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\__init__.py", line 50, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troublesh...error.html
Please note and check the following:
* The Python version is: Python3.11 from "C:\Ejemplos Python\CMC\build\exe.win-amd64-3.11\main.exe"
* The NumPy version is: "1.26.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: No se puede encontrar el módulo especificado.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 139, in run
module_init.run(name + "__main__")
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\cx_Freeze\initscripts\console.py", line 18, in run
exec(code, module_main.__dict__) # pylint: disable=exec-used
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "main.py", line 9, in <module>
File "C:\Ejemplos Python\CMC\inci_cons.py", line 18, in <module>
from crea_mapa import *
File "C:\Ejemplos Python\CMC\crea_mapa.py", line 1, in <module>
import folium #Importa la libreria que crea el mapa
^^^^^^^^^^^^^
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\folium\__init__.py", line 17, in <module>
from folium.features import (
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\folium\features.py", line 11, in <module>
import numpy as np
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\__init__.py", line 149, in <module>
raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
ademas antes de compilar incorpore los archivos _multiarray_umath.cp311-win_amd64.pyd y multiarray.py en la misma carpeta de mi proyecto y luego de generado el .exe en la misma carpeta del .exe y nada. Si alguien me puede dar una mano con esto se lo agradeceria mucho. Gracias