Pyinstaller and seaborn(Pyinstaller和海运)
                            本文介绍了Pyinstaller和海运的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
                        
                        问题描述
我正在尝试部署应用程序,但在导入海运时崩溃
这是我的配置:Python 2.7,pyinstaller 3.3.1,海运0.8.1。
这里是我在installTest.py中编写的要重现的最简单的代码段
import seaborn
print 'It works now!'
然后我在控制台中键入pyinstaller .installTest
我收到一个很长的错误代码,以找不到messagesstream模块终止。
您对如何解决此问题有什么想法吗?
推荐答案
我找到问题了。
首先是这个小示例的工作原理:我修改了我的.spec文件,使其包含一些隐藏的导入以及一些 pandas 和海运内容
# -*- 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')
这篇关于Pyinstaller和海运的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
				 沃梦达教程
				
			本文标题为:Pyinstaller和海运
 
				
         
 
            
        基础教程推荐
             猜你喜欢
        
	     - PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- 修改列表中的数据帧不起作用 2022-01-01
- 求两个直方图的卷积 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- 包装空间模型 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
				 
				 
				 
				