我正试着在Mac上编译我的游戏。当我试图运行我的脚本来构建游戏时,我得到了以下信息:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Developer/Panda3D/direct/showutil/pfreeze.py", line 161, in <module>
sys.exit(main())
File "/Developer/Panda3D/direct/showutil/pfreeze.py", line 148, in main
freezer.done(addStartupModules = addStartupModules)
File "/Developer/Panda3D/direct/showutil/FreezeTool.py", line 985, in done
self.__loadModule(mdef)
File "/Developer/Panda3D/direct/showutil/FreezeTool.py", line 1079, in __loadModule
fp = open(pathname, 'U')
IOError: [Errno 2] No such file or directory: 'example1.subfolder.start'(文件夹和子文件夹只是我的程序的示例,只需将它们替换为您心目中的真实文件夹名称和文件。)为什么会这样呢?文件夹和文件是存在的,我在当前文件夹(build文件夹)中,所有的东西都在那里,所以为什么panda3d没有找到这个文件?我还在每个文件夹和子文件夹中都有init文件,所以这不是问题。有什么办法能解决这个问题吗?这是我的代码:
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('--main-module', default='example1.subfolder.Start',
help='The path to the instantiation module.')
parser.add_argument('modules', nargs='*', default=['example1', 'example2'],
help='The modules to be included in the build.')
args = parser.parse_args()
print 'Building the client...'
os.chdir('build')
cmd = ('ppython')
cmd += ' -m direct.showutil.pfreeze'
args.modules.extend(['direct', 'pandac'])
for module in args.modules:
cmd += ' -i {0}.*.*'.format(module)
cmd += ' -i {0}.*'.format('encodings')
cmd += ' -i {0}'.format('base64')
cmd += ' -i {0}'.format('site')
cmd += ' -o GameData.so'
cmd += ' {0}'.format(args.main_module)
os.system(cmd)发布于 2022-09-09 06:15:34
由于不推荐使用python2和使用新的部署工具的panda3d,问题得到了解决。
发布于 2018-02-21 06:56:39
__init__.py文件吗?
https://stackoverflow.com/questions/48749138
复制相似问题