我正在尝试使用 Pyinstaller 制作我的 python 代码的 exe 以轻松分发。每次我尝试运行 pyinstaller.py 时都会收到错误消息“[Errno 22] invalid mode ('rb') or filename: ''”
我在这个问题上看到了其他一些帖子,说这个问题通常是由文件路径中用于读取数据的硬编码引起的,但是我所有的文件路径都是使用变量完成的,并询问用户文件的位置。
File "pyinstaller.py", line 18, in <module>
run()
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\main.py", line 88, in run
run_build(opts, spec_file, pyi_config)
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\main.py", line 46, in run_build
PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\build.py", line 1924, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\build.py", line 1873, in build
execfile(spec)
File "\PyInstaller-2.1\PyInstaller-2.1\guimain\guimain.spec", line 17, in <module>
console=True )
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\build.py", line 1170, in __init__
strip_binaries=self.strip, upx_binaries=self.upx,
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\build.py", line 1008, in __init__
self.__postinit__()
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\build.py", line 309, in __postinit__
self.assemble()
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\build.py", line 1050, in assemble
dist_nm=inm)
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\build.py", line 842, in checkCache
digest = cacheDigest(fnm)
File "\PyInstaller-2.1\PyInstaller-2.1\PyInstaller\build.py", line 796, in cacheDigest
data = open(fnm, "rb").read()
IOError: [Errno 22] invalid mode ('rb') or filename: ''
任何人有任何想法我可以开始解决这个问题吗?
编辑:使用 2.1 版的 pyinstaller
编辑:所以我尝试通过创建这个来测试我的代码:
import pandas as pd
if __name__ == '__main__':
maindata = pd.DataFrame
print maindata
这给了我同样的错误。