Anaconda Python,Pyinstaller 3.1.1,exe脚本,运行时错误

时间:2016-04-07 00:01:08

标签: python compilation exe anaconda python-3.5

遇到错误消息" pyi_rth_pkgres.py返回-1"
当在Anaconda 64环境中运行python脚本(Python版本3.5.1)到exe时,在2016年4月由Pyinstaller 3.1.1编译(编译过程没有任何错误)。

脚本使用:
大熊猫0.18
qt 4.8.7
qtpy 1.0

1 个答案:

答案 0 :(得分:0)

import pandas as pd
import numpy as np
from PyQt4 import QtCore, QtGui
import sys
import re

class mainWgt(QtGui.QMainWindow):

    def __init__(self):

        # regex stuff
        rex = re.compile('(?<=ss)\d+')
        match = rex.search('ss23423').group(0)

        # Pandas stuff
        self.df = pd.DataFrame(data=np.random.randn(100, 10))
        self.df[4] = self.df[1] + self.df[2]
        self.df[5] = self.df.apply(lambda x: '{}_{}'.format(x[1], x[2]), axis=1)

        # PyQt stuff
        super().__init__()
        self.resize(1000, 1000)
        self.rootWgt = QtGui.QWidget(self)
        self.table = QtGui.QTableWidget(self.rootWgt)
        self.rootWgt_lay = QtGui.QGridLayout(self.rootWgt)
        self.rootWgt_lay.addWidget(self.table, 0, 0, 1, 1)
        self.setCentralWidget(self.rootWgt)
        self.table.setColumnCount(11)
        self.table.setRowCount(111)

        # all together
        self.table.setItem(0, 0, QtGui.QTableWidgetItem())
        self.table.item(0,0).setText(match)
        for i in self.df:
            for j, item in enumerate(self.df[i]):
                self.table.setItem(j, i, QtGui.QTableWidgetItem())
                self.table.item(j, i).setText(str(item))
#} ^ class mainWgt(QtGui.QMainWindow):

app = QtGui.QApplication(sys.argv)
gui = mainWgt()
gui.show()
sys.exit(app.exec_())

这是一个涉及qtpy和pandas的简短示例代码。

我可以使用anaconda64 for windows和pycharm社区版的默认下载编译此代码,全部下载于2016-04-07:

[0]安装Anaconda64 for windows,无需事先安装python。在编写时,Anaconda默认会同时安装3.4.3和3.5.1环境。但是,在以下步骤中,这不会给我带来任何悲伤 [1] cmd:pip install pyinstaller,pip install可以检测到Anaconda的python。
[2] 还原包&#34; setuptools&#34;到19.2 。我在pycharm中做到了(设置,项目:,项目解释器) [3]按照说明如何使用pyinstaller,这里的所有内容都应该是google-able

警告:结果是一个200MB 3000 + 文件夹。如果你只是想要一个快速的exe来做一些小事,远离大包。熊猫的脚本形式处于最佳状态。

相关问题