问题描述
我试图弄清楚如何为我的python应用程序创建Windows可执行文件或Windows安装程序,以便可以与家人一起分发它们。在此示例中,我使用Python Arcade创建了一个跳棋游戏。我正在使用Python 3.8.2和cp_Freeze的最新pip安装,以尝试创建可执行文件。这是设置脚本:
from cx_Freeze import setup,Executable
sys.argv.append("bdist_msi") # build
exe = Executable(
script="Checkers.py",base="Win32GUI",)
includefiles = ["check_icon.ico",os.path.join(os.path.dirname(__file__),'resources','audio',"theme.wav"),"grasstheme.wav"),"fighttheme.wav"),"gamepiece.wav"),"gatecoin.wav"),'images',"check.png")]
setup(name = "Checkers",version = "1.0.0",options = {'build_exe': {
'packages':["arcade","os","time"],'include_files': includefiles,'include_msvcr': True,}},executables = [exe]
)
这是我运行它时收到的错误消息。我遵循了在网上找到的关于使用cx_Freeze的说明,但是我无法弄清楚出了什么问题。
running bdist_msi
running build
running build_exe
Traceback (most recent call last):
File "<absolute_path>\Checkers\setup.py",line 19,in <module>
setup(name = "Checkers",File "<absolute_path>\Python38-32\lib\site-packages\cx_Freeze\dist.py",line 342,in setup
distutils.core.setup(**attrs)
File "<absolute_path>\Python38-32\lib\distutils\core.py",line 148,in setup
dist.run_commands()
File "<absolute_path>\Python38-32\lib\distutils\dist.py",line 966,in run_commands
self.run_command(cmd)
File "<absolute_path>\Python38-32\lib\distutils\dist.py",line 985,in run_command
cmd_obj.run()
File "<absolute_path>\Python38-32\lib\site-packages\cx_Freeze\windist.py",line 389,in run
self.run_command('build')
File "<absolute_path>\Python38-32\lib\distutils\cmd.py",line 313,in run_command
self.distribution.run_command(command)
File "<absolute_path>\Python38-32\lib\distutils\dist.py",in run_command
cmd_obj.run()
File "<absolute_path>\Python38-32\lib\distutils\command\build.py",line 135,in run
self.run_command(cmd_name)
File "<absolute_path>\Python38-32\lib\distutils\cmd.py",in run_command
cmd_obj.run()
File "<absolute_path>\Python38-32\lib\site-packages\cx_Freeze\dist.py",line 217,in run
freezer.Freeze()
File "<absolute_path>\Python38-32\lib\site-packages\cx_Freeze\freezer.py",line 638,in Freeze
self.finder = self._GetModuleFinder()
File "<absolute_path>\Python38-32\lib\site-packages\cx_Freeze\freezer.py",line 379,in _GetModuleFinder
finder.IncludePackage(name)
File "<absolute_path>\Python38-32\lib\site-packages\cx_Freeze\finder.py",line 661,in IncludePackage
module = self._ImportModule(name,deferredImports)
File "<absolute_path>\Python38-32\lib\site-packages\cx_Freeze\finder.py",line 308,in _ImportModule
module = self._InternalImportModule(name,File "<absolute_path>\Python38-32\lib\site-packages\cx_Freeze\finder.py",line 409,in _InternalImportModule
module = self._LoadModule(name,fp,path,info,deferredImports,line 422,in _LoadModule
return self._LoadPackage(name,parent,line 494,in _LoadPackage
self._LoadModule(name,parent)
File "<absolute_path>\Python38-32\lib\site-packages\cx_Freeze\finder.py",line 473,in _LoadModule
self._ScanCode(module.code,module,line 588,in _ScanCode
importedModule = self._ImportModule(name,line 343,line 382,in _InternalImportModule
self._InternalImportModule(parentName,line 397,in _InternalImportModule
spec = importlib.util.find_spec(name)
File "<absolute_path>\Python38-32\lib\importlib\util.py",line 94,in find_spec
parent = __import__(parent_name,fromlist=['__path__'])
File "<absolute_path>\Python38-32\lib\site-packages\pyglet\libs\darwin\__init__.py",line 36,in <module>
from .cocoapy import *
File "<absolute_path>\Python38-32\lib\site-packages\pyglet\libs\darwin\cocoapy\__init__.py",line 32,in <module>
from .runtime import objc,send_message,send_super
File "<absolute_path>\Python38-32\lib\site-packages\pyglet\libs\darwin\cocoapy\runtime.py",line 51,in <module>
objc = cdll.LoadLibrary(util.find_library('objc'))
File "<absolute_path>\Python38-32\lib\ctypes\__init__.py",line 451,in LoadLibrary
return self._dlltype(name)
File "<absolute_path>\Python38-32\lib\ctypes\__init__.py",line 363,in __init__
if '/' in name or '\\' in name:
TypeError: argument of type 'NoneType' is not iterable
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)