Python 皮安和海伯恩
我试图部署一个应用程序,导入seaborn时它崩溃了 这是我的配置:Python 2.7、pyinstaller 3.3.1、seaborn 0.8.1 下面是我在installTest.py中编写的最简单的代码Python 皮安和海伯恩,python,pyinstaller,seaborn,Python,Pyinstaller,Seaborn,我试图部署一个应用程序,导入seaborn时它崩溃了 这是我的配置:Python 2.7、pyinstaller 3.3.1、seaborn 0.8.1 下面是我在installTest.py中编写的最简单的代码 import seaborn print 'It works now!' 然后在控制台中,我键入了pyinstaller.\installTest 我收到一个长错误代码,终止时未找到messagesstream模块 你对如何解决这个问题有什么想法吗?我发现了我的问题 首先,我修改了我
import seaborn
print 'It works now!'
然后在控制台中,我键入了pyinstaller.\installTest
我收到一个长错误代码,终止时未找到messagesstream
模块
你对如何解决这个问题有什么想法吗?我发现了我的问题
首先,我修改了我的.spec文件,以包含一些隐藏的导入和一些pandas和seaborn的东西
# -*- mode: python -*-
block_cipher = None
def get_seaborn_path():
import seaborn
seaborn_path = seaborn.__path__[0]
return seaborn_path
def get_pandas_path():
import pandas
pandas_path = pandas.__path__[0]
return pandas_path
a = Analysis(['installTest.py'],
pathex=['C:\\Users\\Admin\\PycharmProjects\\InstalTest'],
binaries=[],
datas=[],
hiddenimports=['scipy._lib.messagestream', 'pandas._libs.tslibs.timedeltas '],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
dict_tree = Tree(get_seaborn_path(), prefix='seaborn', excludes=["*.pyc"])
dict_tree2 = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
a.datas += dict_tree
a.datas += dict_tree2
a.binaries = filter(lambda x: 'seaborn' not in x[0], a.binaries)
a.binaries += filter(lambda x: 'pandas' not in x[0], a.binaries)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='installTest',
debug=True,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='installTest')
首先,向人们展示你所犯的长期错误是很有用的。你有没有找到替代方法?我正在使用fbs构建我的应用程序,fbs不允许对spec文件进行任何修改(它在冻结期间自动生成)。实现上面提到的两个隐藏导入是可能的,但这本身并不会导致功能二进制。