我最近使用Python 2.7和pygame创建了一个脚本。我尝试过使用py2exe
,但是当我运行它创建的文件时,它会给我这个错误:
G:\Downloads2\GAME\dist\ANNECUTE.exe\zipextimporter.py:82: RuntimeWarning: import display: No module named _view
(ImportError: No module named _view)
G:\Downloads2\GAME\dist\ANNECUTE.exe\zipextimporter.py:82: RuntimeWarning: import draw: No module named _view
(ImportError: No module named _view)
G:\Downloads2\GAME\dist\ANNECUTE.exe\zipextimporter.py:82: RuntimeWarning: import image: No module named _view
(ImportError: No module named _view)
G:\Downloads2\GAME\dist\ANNECUTE.exe\zipextimporter.py:82: RuntimeWarning: import pixelcopy: No module named _view
(ImportError: No module named _view)
G:\Downloads2\GAME\dist\ANNECUTE.exe\zipextimporter.py:82: RuntimeWarning: import transform: No module named _view
(ImportError: No module named _view)
Traceback (most recent call last):
File "ANNECUTE.py", line 45, in <module>
File "pygame\__init__.pyc", line 70, in __getattr__
NotImplementedError: display module not available
(ImportError: No module named _view)
我在setup.py
文件中使用了这个:
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1}},
windows = [{'script': "ANNECUTE.py"}],
zipfile = None,
)
答案 0 :(得分:0)
尝试添加
import pygame._view
致zipextimporter.py
。这将导入_view并消除您的问题。