I\'m working on building a standalone executable for a simple tool I built that uses Basemap. (Using Python 2.7, using the dev version of PyInstaller - 2.1). The .exe (single
Took me a few days, but I think I sorted it from piecing together a few partial solutions:
From http://www.jontrinder.com/blog/?paged=2 :
In pyproj.py, found in C:...\Lib\site-packages\mpl_toolkits\basemap Just past the huge lists is a line that looks something like
pyproj_datadir = os.sep.join([os.path.dirname(__file__), 'data'])
Replace that with
if 'PROJ_DIR' in os.environ:
pyproj_datadir = os.environ['PROJ_DIR']
else:
pyproj_datadir = os.sep.join([os.path.dirname(__file__), 'data'])
The piece that was missing from the linked solution was then adding the data path when actually running PyInstaller with --paths
C:\Python27\python.exe "C:\Python27\Lib\site-packages\pyinstaller-develop\PyInstaller\main.py" --onefile --paths="C:\Python27\Lib\site-packages\mpl_toolkits\*" "C:\Documents and Settings\KAHERE\My Documents\Python code\Flood\src\root\nested\FloodRisk.py"
pause
Just thought I'd post in case anyone else was banging their head on this one.