我正在尝试为我用Python编程的简单游戏创建一个.exe文件。从python中运行,当我构建它并尝试打开.exe时,我收到以下错误:
File "/usr/lib/pymodules/python2.7/cx_Freeze/initscripts/Console.py", line 27, in <module>
exec code in m.__dict__
File "snakegame.py", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pygame/__init__.py", line 346, in <module>
import pygame.surfarray
File "/usr/local/lib/python2.7/dist-packages/pygame/surfarray.py", line 72, in <module>
import pygame._numpysurfarray as numpysf
File "/usr/local/lib/python2.7/dist-packages/pygame/_numpysurfarray.py", line 51, in <module>
import numpy
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 163, in <module>
from .core import *
AttributeError: 'module' object has no attribute 'sys'
从这个讨论中
https://mail.scipy.org/pipermail/numpy-discussion/2013-February/065596.html
我尝试编辑/numpy/core/__init__.py
,即在结尾处删除行del sys
。但它没有帮助,我尝试运行.exe时遇到同样的错误。什么可以解决方案?