简体   繁体   English

AttributeError:使用CX_FREEZE构建Python 3.6可执行文件时,模块'dis'没有属性'_unpack_opargs'

[英]AttributeError: module 'dis' has no attribute '_unpack_opargs' While Building Python 3.6 executable using CX_FREEZE

I have been trying to Convert my Python 3.6 Programs into.EXE. 我一直在尝试将Python 3.6程序转换为.EXE。 When I build using cx_Freeze. 当我使用cx_Freeze构建时。 It generates the following error. 它生成以下错误。 (See Log Below) (请参阅下面的日志)

I was earlier working with Kivy Module but after the build failed repeatedly I tried it with simple Hello World Program still, It failed. 我之前使用过Kivy Module,但是在构建失败多次后,我仍然使用简单的Hello World Program对其进行了尝试,但失败了。

My setup file contains from cx_Freeze import setup, Executable import statement, 我的设置文件包含from cx_Freeze import setup, Executable导入语句,

When I build through python setup.py build It generates this log. 当我通过python setup.py build它将生成此日志。

F:\Python\test>python setup.py build
running build
running build_exe
Traceback (most recent call last):
  File "setup.py", line 7, in 
    executables = [Executable('hello.py')])
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\dist.py", line 349, in setup
    distutils.core.setup(**attrs)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\distutils\core.py", li
ne 148, in setup
    dist.run_commands()
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\distutils\dist.py", li
ne 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\distutils\dist.py", li
ne 974, in run_command
    cmd_obj.run()
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\distutils\command\buil
d.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\distutils\cmd.py", lin
e 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\distutils\dist.py", li
ne 974, in run_command
    cmd_obj.run()
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\dist.py", line 219, in run
    freezer.Freeze()
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\freezer.py", line 621, in Freeze
    self.finder = self._GetModuleFinder()
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\freezer.py", line 333, in _GetModuleFinder
    self.path, self.replacePaths)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\finder.py", line 150, in init
    self._AddBaseModules()
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\finder.py", line 161, in _AddBaseModules
    self.IncludeModule("traceback")
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\finder.py", line 645, in IncludeModule
    namespace = namespace)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\finder.py", line 310, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\finder.py", line 403, in _InternalImportModule
    parentModule, namespace)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\finder.py", line 474, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freez
e\finder.py", line 544, in _ScanCode
    method = dis._unpack_opargs if sys.version_info[:2] >= (3, 5) \
AttributeError: module 'dis' has no attribute '_unpack_opargs'

F:\Python\test>

Thanks for your Help. 谢谢你的帮助。

1. Open File C:\\Users\\UserName\\AppData\\Local\\Programs\\Python\\Python35-32\\lib\\site-packages\\cx_Freeze\\finder.py : 1.打开文件C:\\Users\\UserName\\AppData\\Local\\Programs\\Python\\Python35-32\\lib\\site-packages\\cx_Freeze\\finder.py

2. Change (at line 544 ) this: 2.更改(在line 544 ):

   method = dis._unpack_opargs if sys.version_info[:2] >= (3, 5) \
   else self._UnpackOpArgs

to: 至:

   method = self._UnpackOpArgs

3. Save the file and try to build again ;) 3.保存文件,然后尝试重新构建;)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 cx_freeze AttributeError:模块'dis'没有属性'_unpack_opargs' - cx_freeze AttributeError: module 'dis' has no attribute '_unpack_opargs' 获取AttributeError:运行cx_Freeze可执行文件时,模块'tensorflow_estimator.python.estimator.api.estimator'没有属性'__file__' - Getting AttributeError: module 'tensorflow_estimator.python.estimator.api.estimator' has no attribute '__file__' when running a cx_Freeze executable 使用cx_Freeze从Python3.6脚本导入pandas构建可执行文件时出错 - Error when building executable from Python3.6 script importing pandas using cx_Freeze Python,AttributeError:cx_Freeze 构建后,模块“google.cloud.bigquery”没有属性“Client” - Python, AttributeError: module 'google.cloud.bigquery' has no attribute 'Client' after cx_Freeze build 使用 cx_Freeze 将 python 文件转换为可执行文件,然后得到错误 AttributeError: 'list' object has no attribute 'main_script' - Convert a python file into an executable with cx_Freeze then get error AttributeError: 'list' object has no attribute 'main_script' python 3.6中的cx_freeze - cx_freeze in python 3.6 cx_freeze attributeerror: 'windowspath' object 没有属性 'write' 错误 - cx_freeze attributeerror: 'windowspath' object has no attribute 'write' error windows cx_freeze 上的“AttributeError: 'NoneType' object 没有属性写入” - “AttributeError: ‘NoneType’ object has no attribute write” on windows cx_freeze 运行cx_freeze构建的python可执行文件时出现奇怪的core_cy模块导入错误 - Strange core_cy module import error while running cx_freeze built python executable 使用 cx_Freeze 将 Python 转换为 exe 时出现 Scipy 和 Cython 的 AttributeError - AttributeError with Scipy and Cython while converting Python to exe with cx_Freeze
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM