cx_Freeze ModuleNotFoundError: No module named 

2019-07-23 06:36发布

Trying to convert a .py file into a .exe when trying to run the .exe file in the exe.win32-3.6 folder I get the following error:

C:\Users\Aktan\Desktop\build\exe.win32-3.6>StatisticsCalculator.exe
Fatal Python error: Py_Initialize: unable to load the file system codec
Traceback (most recent call last):
  File "C:\Users\Aktan\AppData\Local\Programs\Python\Python36-32\lib\encodings\__init__.py", line 31, in <module>
ModuleNotFoundError: No module named 'codecs'

here is my setup.py code:

import cx_Freeze
import sys
import os
import matplotlib

os.environ['TCL_LIBRARY'] = "C:\\LOCAL_TO_PYTHON\\Python35-32\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\LOCAL_TO_PYTHON\\Python35-32\\tcl\\tcl8.6"

base = None

if sys.platform == 'win32':
    base='Win32GUI'

executables = [cx_Freeze.Executable("StatisticsCalculator.py", base=None)]

cx_Freeze.setup(
    name="This is a tes",
    options = {"build_exe": {"packages":["numpy"]}},
    version = "0.01",
    description = "Trying to get this to work",
    executables = executables
    )

and I do not know if it helps, but here are the modules I use in my python program:

import sqlite3
from math import pow, sqrt
from tkinter import Tk, Label, Listbox, END, Button, Message, messagebox
import matplotlib.pyplot as plt

I have python 3.6.3 and I am running Windows 10. Any response would be appreciated.

1条回答
smile是对你的礼貌
2楼-- · 2019-07-23 07:27

This is a known issue with cx_Freeze which has been resolved in the source. A new release (5.1.1) will be out shortly to correct that issue!

查看更多
登录 后发表回答