AttributeError:模块'win32ctypes.pywin32.win32api'没有属性'错误'
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AttributeError:模块'win32ctypes.pywin32.win32api'没有属性'错误'相关的知识,希望对你有一定的参考价值。
(venv) C:UsersidanfPycharmProjectsuntitled>pyinstaller -w -F -i "C:UsersidanfPycharmProjectsuntitledlogo.png" gui.py
最上面有我用来创建exe的命令。 py文件中的文件。
我正在尝试将我的gui.py(用于gui的pyqt5 lib)制作为exe文件,并收到此错误。
我该如何修复或创建该exe。文件以其他方式?
我尝试使用cmd和pycharm,并且都遇到相同的问题。
如果需要,我可以提供代码。
如果我需要提供更多信息,请告诉我
80 INFO: PyInstaller: 3.5
81 INFO: Python: 3.7.3
81 INFO: Platform: Windows-10-10.0.18362-SP0
83 INFO: wrote C:UsersidanfPycharmProjectsuntitledgui.spec
87 INFO: UPX is not available.
89 INFO: Extending PYTHONPATH with paths
['C:\Users\idanf\PycharmProjects\untitled',
'C:\Users\idanf\PycharmProjects\untitled']
89 INFO: checking Analysis
117 INFO: checking PYZ
135 INFO: checking PKG
144 INFO: Building because C:UsersidanfPycharmProjectsuntitleduildguigui.exe.manifest changed
144 INFO: Building PKG (CArchive) PKG-00.pkg
463 WARNING: One binary added with two internal names.
464 WARNING: ('libGLESv2.dll',
'C:\users\idanf\anaconda3\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll',
'BINARY')
464 WARNING: was placed previously at
465 WARNING: ('PyQt5\Qt\bin\libGLESv2.dll',
'C:\users\idanf\anaconda3\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll',
'BINARY')
14719 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
14724 INFO: Bootloader c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstallerootloaderWindows-64bit
unw.exe
14725 INFO: checking EXE
14725 INFO: Building EXE because EXE-00.toc is non existent
14725 INFO: Building EXE from EXE-00.toc
14730 INFO: Copying icons from C:UsersidanfPycharmProjectsuntitledlogo.png
Traceback (most recent call last):
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packageswin32ctypespywin32pywintypes.py", line 35, in pywin32error
yield
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packageswin32ctypespywin32win32api.py", line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags)
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packageswin32ctypescorectypes\_util.py", line 42, in check_null
raise make_error(function, function_name)
OSError: [WinError 193] <no description>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstallerutilswin32icon.py", line 231, in CopyIcons
hsrc = win32api.LoadLibraryEx(srcpath, 0, LOAD_LIBRARY_AS_DATAFILE)
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packageswin32ctypespywin32win32api.py", line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags)
File "C:UsersidanfAnaconda3libcontextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packageswin32ctypespywin32pywintypes.py", line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (193, 'LoadLibraryExW', '<no description>')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersidanfAnaconda3lib
unpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:UsersidanfAnaconda3lib
unpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:UsersidanfPycharmProjectsuntitledvenvScriptspyinstaller.exe\__main__.py", line 9, in <module>
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstalleruildinguild_main.py", line 844, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstalleruildinguild_main.py", line 791, in build
exec(code, spec_namespace)
File "C:UsersidanfPycharmProjectsuntitledgui.spec", line 33, in <module>
console=False , icon='C:\Users\idanf\PycharmProjects\untitled\logo.png')
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstalleruildingapi.py", line 444, in __init__
self.__postinit__()
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstalleruildingdatastruct.py", line 158, in __postinit__
self.assemble()
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstalleruildingapi.py", line 534, in assemble
icon.CopyIcons(tmpnm, self.icon)
File "c:usersidanfpycharmprojectsuntitledvenvlibsite-packagesPyInstallerutilswin32icon.py", line 232, in CopyIcons
except win32api.error as W32E:
AttributeError: module 'win32ctypes.pywin32.win32api' has no attribute 'error'
答案
我是python的新手。但是,我有同样的错误。当我尝试这些东西时,它对我有用。
- 尝试为应用程序图标使用.ico文件
- 尝试将该.ico文件的目录更改为脚本目录,然后再次运行。
以上是关于AttributeError:模块'win32ctypes.pywin32.win32api'没有属性'错误'的主要内容,如果未能解决你的问题,请参考以下文章
Python - celery 相关报错 - AttributeError: type object '_multiprocessing.win32' has no attribute
AttributeError:模块'tensorflow'没有属性'__version __'
AttributeError:模块'django.contrib.auth.views'没有属性'LoginView'
AttributeError:模块'theano'没有属性'ifelse'