我正在使用glade和gtk在Windows 64系统上运行Python 2.7来构建一个简单的UI。我试图从我在下面写的python脚本创建一个可执行文件:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class Handler:
def onDeleteWindow(self, *args):
Gtk.main_quit(*args)
builder = Gtk.Builder()
builder.add_from_file("TEST.glade")
builder.connect_signals(Handler())
window = builder.get_object("window1")
window.show_all()
Gtk.main()
当我尝试使用pyinstaller创建可执行文件时,我收到以下错误:
140 INFO: PyInstaller: 3.2.1
141 INFO: Python: 2.7.13
141 INFO: Platform: Windows-10-10.0.15063
144 INFO: UPX is not available.
144 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Michaela\\HelloTest', 'C:\\Users\\Michaela']
144 INFO: checking Analysis
187 INFO: Building because C:\Users\Michaela\HelloTest\test.py changed
187 INFO: Initializing module dependency graph...
196 INFO: Initializing module graph hooks...
482 INFO: running Analysis out00-Analysis.toc
490 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
required by c:\users\michaela\anaconda2\python.exe
654 INFO: Found C:\WINDOWS\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_acd0e4ffe1daef0a.manifest
657 INFO: Found C:\WINDOWS\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9279_none_acd3d86fe1d846c4.manifest
782 INFO: Searching for assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.9279_none ...
782 INFO: Found manifest C:\WINDOWS\WinSxS\Manifests\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9279_none_08e667efa83ba076.manifest
785 INFO: Searching for file msvcr90.dll
786 INFO: Found file C:\WINDOWS\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9279_none_08e667efa83ba076\msvcr90.dll
786 INFO: Searching for file msvcp90.dll
786 INFO: Found file C:\WINDOWS\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9279_none_08e667efa83ba076\msvcp90.dll
787 INFO: Searching for file msvcm90.dll
788 INFO: Found file C:\WINDOWS\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9279_none_08e667efa83ba076\msvcm90.dll
867 INFO: Found C:\WINDOWS\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_acd0e4ffe1daef0a.manifest
868 INFO: Found C:\WINDOWS\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9279_none_acd3d86fe1d846c4.manifest
870 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 9279)
980 INFO: Caching module hooks...
992 INFO: Analyzing C:\Users\Michaela\HelloTest\test.py
12187 INFO: Processing pre-find module path hook distutils
12960 INFO: Processing pre-safe import module hook _xmlplus
13196 INFO: Processing pre-safe import module hook six.moves
14294 INFO: Processing pre-safe import module hook win32com
19996 INFO: Processing pre-safe import module hook gi.repository.Gtk
20182 INFO: Loading module hooks...
20183 INFO: Loading module hook "hook-distutils.py"...
20186 INFO: Loading module hook "hook-sysconfig.py"...
20187 INFO: Loading module hook "hook-gi.py"...
20210 INFO: Loading module hook "hook-xml.py"...
20440 INFO: Loading module hook "hook-cryptography.py"...
21407 INFO: Loading module hook "hook-httplib.py"...
21407 INFO: Loading module hook "hook-gi.repository.Gtk.py"...
Traceback (most recent call last):
File "<string>", line 3, in <module>
AttributeError: 'module' object has no attribute 'require_version'
22427 ERROR: gi repository 'GIRepository 2.0' not found. Please make sure libgirepository-gir2.0 resp. lib64girepository-gir2.0 is installed.
Traceback (most recent call last):
File "<string>", line 3, in <module>
AttributeError: 'module' object has no attribute 'require_version'
23447 ERROR: gi repository 'GIRepository 2.0' not found. Please make sure libgirepository-gir2.0 resp. lib64girepository-gir2.0 is installed.
Traceback (most recent call last):
File "<string>", line 3, in <module>
AttributeError: 'module' object has no attribute 'require_version'
24348 ERROR: gi repository 'GIRepository 2.0' not found. Please make sure libgirepository-gir2.0 resp. lib64girepository-gir2.0 is installed.
Traceback (most recent call last):
File "<string>", line 3, in <module>
AttributeError: 'module' object has no attribute 'require_version'
25251 ERROR: gi repository 'GIRepository 2.0' not found. Please make sure libgirepository-gir2.0 resp. lib64girepository-gir2.0 is installed.
Traceback (most recent call last):
File "<string>", line 3, in <module>
AttributeError: 'module' object has no attribute 'require_version'
26157 ERROR: gi repository 'GIRepository 2.0' not found. Please make sure libgirepository-gir2.0 resp. lib64girepository-gir2.0 is installed.
Traceback (most recent call last):
File "<string>", line 3, in <module>
AttributeError: 'module' object has no attribute 'require_version'
Traceback (most recent call last):
File "c:\users\michaela\anaconda2\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\users\michaela\anaconda2\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\Michaela\Anaconda2\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\building\build_main.py", line 788, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\building\build_main.py", line 734, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\building\build_main.py", line 212, in __init__
self.__postinit__()
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in __postinit__
self.assemble()
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\building\build_main.py", line 470, in assemble
module_hook.post_graph()
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\building\imphook.py", line 409, in post_graph
self._load_hook_module()
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\building\imphook.py", line 376, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\hooks\hook-gi.repository.Gtk.py", line 29, in <module>
datas += collect_glib_etc_files('fonts')
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\utils\hooks\gi.py", line 215, in collect_glib_etc_files
glib_config_dirs = get_glib_sysconf_dirs()
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\utils\hooks\gi.py", line 179, in get_glib_sysconf_dirs
return [os.path.join(get_gi_libdir('GLib', '2.0'), 'etc')]
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\utils\hooks\gi.py", line 41, in get_gi_libdir
path = findSystemLibrary(lib.strip())
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\depend\bindepend.py", line 922, in findSystemLibrary
return getfullnameof(name)
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\depend\bindepend.py", line 82, in getfullnameof
if os.path.exists(npth) and matchDLLArch(npth):
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\depend\bindepend.py", line 194, in matchDLLArch
pe = pefile.PE(filename, fast_load=True)
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\lib\pefile.py", line 1720, in __init__
self.__parse__(name, data, fast_load)
File "c:\users\michaela\anaconda2\lib\site-packages\PyInstaller\lib\pefile.py", line 1780, in __parse__
raise Exception('Unable to access file \'{0}\'{1}'.format(fname, exception_msg))
Exception: Unable to access file 'c:\users\michaela\anaconda2\DLLs\': [Errno 2] No such file or directory: 'c:\\users\\michaela\\anaconda2\\DLLs\\'
它不会最终编译。有人有过并修复过类似的问题吗?
任何帮助将不胜感激!