Encountered error message "pyi_rth_pkgres.py returns -1"
when running python script (Python version 3.5.1) to exe in Anaconda 64 environment, compiled (compilation process did not have any errors) by Pyinstaller 3.1.1 as of April 2016.
the scripts uses:
pandas 0.18
qt 4.8.7
qtpy 1.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_())
Here is a short sample code involving qtpy and pandas.
I can compile this code with default download from anaconda64 for windows and pycharm community edition, all downloaded on 2016-04-07:
[0] install Anaconda64 for windows without prior install of python. As time of writting, Anaconda by default will install both 3.4.3 and 3.5.1 environment. But that does not cause any grief for me in the following steps.
[1] cmd: pip install pyinstaller, pip install can detect Anaconda's python.
[2] revert package "setuptools" to 19.2. I did that in pycharm (Settings, Project:, Project Interpreter) [3] follow instructions how to use pyinstaller, everything from here should be google-able
Caveat: the result is a 200MB 3000+ files folder. If you just want a quick exe to do some small chores, stay away from big packages. Pandas is at its best in its scripting form.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments