Intento hacer un ejecutable exe con este archivo setup.py:
from distutils.core import setup
import py2exe
from math import sqrt
setup(console=['C:\\Users\\Daniel\\Desktop\\programa python\\programa.py'])
El programa.py funciona perfectamente en el motor de python. Me da el siguiente error:
C:\Users\Daniel\Desktop\programa python>python setup.py py2exe
running py2exe
3 missing Modules
------------------
? _posixshmem imported from multiprocessing.resource_tracker, multiprocessing.shared_memory
? readline imported from cmd, code, pdb
? test imported from multiprocessing.util
Building 'dist\programa.exe'.
error: [WinError 87] El parámetro no es correcto.
C:\Users\Daniel\Desktop\programa python>
Como ya he dicho, el programa, que es una prueba, es muy sencillo y funciona bien en el motor de Python:
import math
print("prueba")
raiz=math.sqrt(25)
print(raiz)
He puesto "import math" en el setup. Es decir, importo el módulo math completo, pero sigue sin funcionar. En el tutorial de py2exe dice que hay que instalar el Microsoft Visual C runtime DLL. Nada, lo he instalado y sigue igual. También he incluido el siguiente bloque en el programa principal, sin resultado: '' ' if name == 'main': root.mainloop() '' ' Importando previamente la función a la que hace referencia root. Mismo mensaje de error.
Solucionado. He vuelto instalar Python en 32 bits (no sé si anteriormente me habría instalado el de 64 sin querer). También pywin32 y pyreadline.