我有一个用Gtk3 Python3.4(Windows)构建的应用程序在Pycharm上工作正常但是当我使用cx_freeze创建一个exe时,它会出现以下错误 -
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
exec(code, m.__dict__)
File "obfuscated.py", line 2, in <module>
File "C:\Python34\lib\site-packages\gi\__init__.py", line 118, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available
我在我的应用中完成的导入是 -
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, Gio, GObject
import sqlite3
我的setup.py文件 -
from cx_Freeze import setup, Executable
#import os
#os.environ['TCL_LIBRARY'] = "C:\\Users\\BRAHMDEV\\AppData\\Local\\Programs\\Python\\Python36\\tcl\\tcl8.6"
#os.environ['TK_LIBRARY'] = "C:\\Users\\BRAHMDEV\\AppData\\Local\\Programs\\Python\\Python36\\tcl\\tk8.6"
executables = [
Executable("obfuscated.py",
icon="evm_bg_KYa_icon.ico")
]
buildOptions = {"packages":["sqlite3", "gi"], "include_files":["mydatabase.db", "AgeSearch.png", "android.png", "candidate.jpg",
"CasteSearch.png", "duplicate.png", "FileStyle.css", "GenSearch.png", "Hof.png", "Placeholder.png", "voter slip.png"]}
setup(name="Voter Search Engine",
version="2.1.3",
description="Voter Search Engine Setup",
options={"build_exe":buildOptions},
executables=executables,
)
当我执行python setup.py build时,发生了这种情况 -