I am trying to freeze a Python script that contains an import from osgeo
but the executable fails with an ImportError: No module named '_gdal'
.
I've stripped down my script to just one line:
import osgeo
When running in Python (version 3.3.3) all is well. I've tried freezing with cx_Freeze and py2exe. Both report that there is a missing module: ? _gdal imported from osgeo
(among others) but successfully freeze the script. Then the exe fails with the above ImportError.
I've tried importing _gdal
in python and it works. I tried manually including the osgeo
module in the freezing options but still get the same error.
There is a similar question here: Importing GDAL with cx_Freeze, Python3.4 but maybe this isn't a cx_freeze issue because it also happens with py2exe (it has experimental support for python 3 now).
Does anybody know how to fix this?