尝试将.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。如果有任何回复,我将不胜感激。
发布于 2017-12-12 13:32:08
这是cx_Freeze的一个已知问题,已在源代码中解决。一个新的版本(5.1.1)将很快发布来纠正这个问题!
https://stackoverflow.com/questions/47738236
复制相似问题