这是我的setup.py文件:
import sys
from cx_Freeze import setup, Executable
sys.path.append(r'../lib/driver/src/')
sys.path.append(r'../lib/instrument/src/')
sys.path.append(r'../lib/routing/src/')
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os", "pyvisa", "pyodbc", "numpy", "scipy", "skrf",],
"includes" : ["matplotlib.backends.backend_tkagg", 'tkinter.filedialog'],
"include_files": [('C:\\temp\\py34x64\\Lib\\site-packages\\scipy-0.15.0-py3.4-win-amd64.egg\\scipy\\special\\_ufuncs.pyd','_ufuncs.pyd')],
"zip_includes": [('C:\\Users\\user\\workspace\\routing-app\\lib\\scikit-rf\\skrf\\data\\ntwk1.s2p', 'ntwk1.s2p')]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
#base = "Win32GUI"
base = 'Console'
setup( name = "SomeName",
version = "1.0",
description = "Some Description",
options = {"build_exe": build_exe_options},
executables = [Executable("main.py", base=base)])
因此,我明确地告诉cx_freeze将ntwk1.s2p包含在library.zip文件中,它就是这样做的。
但是,当我运行exe文件时:
File "c:\Python34\lib\site-packages\scikit_rf-0.15.dev0-py3.4.egg\skrf\data\__init__.py", line 26, in <module> ntwk1 = Network(os.path.join(pwd, 'ntwk1.s2p'))
File "c:\Python34\lib\site-packages\scikit_rf-0.15.dev0-py3.4.egg\skrf\network.py", line 363, in __init__
fid = get_fid(file,'rb')
File "c:\Python34\lib\site-packages\scikit_rf-0.15.dev0-py3.4.egg\skrf\util.py", line 164, in get_fid
return open(file, *args, **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: 'c:\\Users\\user\\workspace\\routing-app\\src\\build\\exe.win-amd64-3.4\\library.zip\\skrf\\data\\ntwk1.s2p'
那么为什么应用程序无法在library.zip中找到该文件?感觉就像cx_freeze在执行util.py模块时没有解压缩library.zip。有什么想法吗?