0
I am trying to convert a Python script to exe to run on Windows machines, I have the following code in setup.py
import sys
from cx_Freeze import setup, Executable
import subprocess
import socket
import os
base = None
if sys.platform == "win32":
base = "Win32GUI"
executables = [
Executable("lista.py", base=base)
]
buildOptions = dict(
packages = [],
includes = ["subprocess","socket","os"],
include_files = [
os.path.join('C:\\Users\\Eduardo\\AppData\\Local\\Programs\\Python\\Python36-32', 'DLLs', 'tk86t.dll'),
os.path.join('C:\\Users\\Eduardo\\AppData\\Local\\Programs\\Python\\Python36-32', 'DLLs', 'tcl86t.dll'),
],
excludes = []
)
os.environ['TCL_LIBRARY'] = "C:\\Users\\Eduardo\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Users\\Eduardo\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tk8.6"
setup(
name = "ListaConfigs",
version = "0.0.1",
description = "Recolhe Informações do Computador",
options = dict(build_exe = buildOptions),
executables = executables
)
Looking for solutions found the links:Solution 1 and Solution 2 The problem is that both are errors. When I try to execute the command:
pyinstaller -F setup.py
Returns the following error:
return module_code_object.co_names[co_names_index]
IndexError: tuple index out of range
The -F builds it with only one executable, without the other many files that are normally generated.
When I try cx_Freeze with the command:
python setup.py build
or python setup.py bdist_msi
Of the error:
raise KeyError(key) from None
KeyError: 'TCL_LIBRARY'
There is no python folder in Program Files or in x86. For some reason it was installed in this path that is in the code.
I don’t know what else can be done here.
Thank you for your attention
OBS.: I searched and it seems that pyinstaller is not yet compatible with python 3.6(Link that says so so you shouldn’t use a previous version to work