【发布时间】:2017-12-10 11:13:01
【问题描述】:
尝试将 .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。任何回复将不胜感激。
【问题讨论】:
-
@Simon 但那个人正在运行 ubuntu,其中一个答案甚至说 ubuntu 已经修改了 python。
-
好的。在我尝试其他任何事情之前,不要检查这些帮助。我目前处于 AFK 状态,但稍后我会看看我能做什么。
-
@Simon 好的,谢谢
标签: windows-10 python-3.6 cx-freeze