cx_Freeze ModuleNotFoundError:没有名为'编解码器的模块'

时间:2017-12-10 11:13:02

标签: windows-10 python-3.6 cx-freeze

尝试将.py文件转换为.exe文件 当试图在exe.win32-3.6文件夹中运行.exe文件时,我收到以下错误:

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'

这是我的setup.py代码:

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
    )

我不知道它是否有帮助,但这里是我在python程序中使用的模块:

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

我有python 3.6.3并且我正在运行Windows 10.任何回复都将不胜感激。

1 个答案:

答案 0 :(得分:1)

这是cx_Freeze的已知问题,已在源代码中解决。不久将发布一个新版本(5.1.1)以纠正该问题!