我是Stack Overflow的新手,并且对使用Python还是很陌生,最近我一直在尝试为使用cx_freeze的Python脚本创建一个msi文件。基本上,我在创建与导入savReaderWriter有关的msi安装程序时遇到了问题。我使用的是Windows 10 64位计算机,使用的是Python 3.6.5,我使用的cx_freeze版本是6.0b1。我决定创建一个简单的脚本,在其中导入savReaderWriter,并将其命名为“ SPSS_import1.py”,并且在该文件中包含:
import savReaderWriter as s
SAVFILE = 'test.sav'
SPSSFILE = s.SavReader(SAVFILE,returnHeader =True)
我还创建了一个安装文件,并将其命名为“ setup_SPSS1.py”,代码为:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
options = {
'build_exe': {
'includes': ['savReaderWriter']
}
}
executables = [
Executable('SPSS_import1.py', base=base)
]
setup(name='Test',
version='0.1',
description='Testing only',
options=options,
executables=executables
)
然后进入命令提示符,然后尝试使用bdist_msi创建安装程序文件并从头开始构建它:
python setup_SPSS1.py bdist_msi
然后我遇到了FCI错误1消息(如下所示)。在设置函数中的可执行文件参数中似乎有些抱怨,但我不确定是什么导致了错误。可能是cx_freeze模块中的错误吗?欢迎任何想法或建议。
creating dist
Traceback (most recent call last):
File "setup_SPSS1.py", line 22, in <module>
executables=executables
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\dist.py", line 348, in setup
distutils.core.setup(**attrs)
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\windist.py", line 392, in run
self.add_files()
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\windist.py", line 133, in add_files
cab.commit(db)
File "C:\Users\Username\AppData\Local\Programs\Pythostrong textn\Python36\lib\msilib\__init__.py", line 217, in commit
FCICreate(filename, self.files)
ValueError: FCI error 1