Here are the steps:
1.First install Visual Studio (C++) 2005. Install Service Pack 1 (VS80sp1-KB926601-X86-ENU.exe).
2. Install QT open source and add to path (To do this right-click on My Computer and go to properties,
in the dialog click on the Advanced tag and within click on the Environment Variables. In the User variables for x list box click on Path and Edit to add the following directories: C:\Qt\4.4.0\bin;)
3. Open the command prompt installed with MSVC 2005 (Program->Microsoft Visual Studio 2005->Visual Studio Tools->Visual Studio 2005 command prompt) and configure QT by going into the root directory C:\Qt\4.4.0 and running configure.exe to setup QT for VS 2005 by running the command "configure -platform win32-msvc2005" (this can take up to an hour to run)
4. Once it has finished successfully then from the same directory path run the command "nmake" and this will also take several hours.
5. Install a Python for windows package. I used the excellent Enthought Python distribution as it contains matplotlib
5. Download the windows source of sip from http://www.riverbankcomputing.co.uk/software/sip/download and build following the instructions but use nmake from inside the MSVC 2005 cmd prompt instead of make. The binaries are built with MSVC 2008 on the site so you can't use this as you'll run in to dll problems.
6. Do the same thing for PyQt4 by downloading it from http://www.riverbankcomputing.co.uk/software/pyqt/download
7. Find a PyQt4 program and see if it works. I used embedding_in_qt4.py from matplotlib. Just double click it after downloading it.
8. Download and install py2exe. I used the Windows binary version.
9. create a setpy.py and put in the same directory as the PyQt4 app. I used the one below, it was borrowed from a website but I can't remember where. I ended up putting it in c:\temp\embqt4\ as I'm not sure if it can handle long file names or names with spaces.
10. run python setup.py py2exe
11. go in to the dist directory and run the .exe file in there
12. get excitied as it runs
Setup.py
# Used successfully in Python2.5 with matplotlib 0.91.2 and PyQt4 (and Qt 4.3.3)
from distutils.core import setup
import py2exe
# We need to import the glob module to search for all files.
import glob
# We need to exclude matplotlib backends not being used by this executable. You may find
# that you need different excludes to create a working executable with your chosen backend.
# We also need to include include various numerix libraries that the other functions call.
opts = {
#'py2exe': { "includes" : ["sip", "PyQt4._qt", "matplotlib.backends", "matplotlib.backends.backend_qt4agg",
'py2exe': { "includes" : ["sip", "PyQt4.Qt", "matplotlib.backends", "matplotlib.backends.backend_qt4agg",
"matplotlib.figure","pylab", "numpy", "matplotlib.numerix.fft",
"matplotlib.numerix.linear_algebra", "matplotlib.numerix.random_array",
"matplotlib.backends.backend_tkagg"],
'excludes': ['_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg',
'_fltkagg', '_gtk', '_gtkcairo', ],
'dll_excludes': ['libgdk-win32-2.0-0.dll',
'libgobject-2.0-0.dll']
}
}
# Save matplotlib-data to mpl-data ( It is located in the matplotlib\mpl-data
# folder and the compiled programs will look for it in \mpl-data
# note: using matplotlib.get_mpldata_info
data_files = [(r'mpl-data', glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\*.*')),
# Because matplotlibrc does not have an extension, glob does not find it (at least I think that's why)
# So add it manually here:
#(r'mpl-data', [r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\matplotlibrc']),
(r'mpl-data\images',glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\images\*.*')),
(r'mpl-data\fonts',glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\fonts\*.*'))]
# for console program use 'console = [{"script" : "scriptname.py"}]
setup(windows=[{"script" : "embqt4.py"}], options=opts, data_files=data_files)
All of the interesting technological, artistic or just plain fun subjects I'd investigate if I had an infinite number of lifetimes. In other words, a dumping ground...
Subscribe to:
Post Comments (Atom)
1 comment:
Oh!! god bless u man. Finally my project is done.
Post a Comment