cx_Freeze ModuleNotFoundError: No module named 'codecs'

六月ゝ 毕业季﹏ 提交于 2020-01-05 12:58:06

问题


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:


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!



来源:https://stackoverflow.com/questions/47738236/cx-freeze-modulenotfounderror-no-module-named-codecs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!