0
我正在嘗試使用py2exe
來執行腳本。AttributeError:'NoneType'對象沒有屬性'split'?
這裏是我的setup.py
代碼:
import cx_Freeze
executables = [cx_Freeze.Executable("Email.py")]
cx_Freeze.setup(
name="Email",
options={"build_exe": {"packages":["pygame"],
"include_files":["aura.png"]}},
executables = executables
)
我跑這從我的cmd,然後在這裏是執行:
G:\Grade 12 Project>python setup.py build running build running build_exe creating directory build\exe.win32-2.7 copying C:\Python27\lib\site-packages\cx_Freeze\bases\Console.exe -> build\exe.win32-2.7\Email.exe copying C:\WINDOWS\SYSTEM32\python27.dll
-> build\exe.win32-2.7\python27.dll Traceback (most recent call last): File "setup.py", line 9, in <module>
executables = executables File "C:\Python27\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
distutils.core.setup(**attrs) File "C:\Python27\lib\distutils\core.py", line 151, in setup
dist.run_commands() File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd) File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run() File "C:\Python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name) File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command) File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run() File "C:\Python27\lib\site-packages\cx_Freeze\dist.py", line 219, in run
freezer.Freeze() File "C:\Python27\lib\site-packages\cx_Freeze\freezer.py", line 623, in Freeze
self._FreezeExecutable(executable) File "C:\Python27\lib\site-packages\cx_Freeze\freezer.py", line 225, in
_FreezeExecutable
self._AddVersionResource(exe) File "C:\Python27\lib\site-packages\cx_Freeze\freezer.py", line 165, in
_AddVersionResource
trademarks = exe.trademarks) File "C:\Python27\lib\site-packages\cx_Freeze\freezer.py", line 759, in
__init__
parts = version.split(".") AttributeError: 'NoneType' object has no attribute 'split'
而且在我的build文件夾,當我運行Email.exe
,我得到這個錯誤:
ImportError: No module named __startup__
我想你也必須提供版本號。它試圖分割「x.x.x」類型的字符串,但由於您沒有提供它,所以會引發錯誤。 – MYGz
@amin,這是一個微不足道的編輯。 –
@MohammadYusufGhazi,版本號? –