Sometimes when you write programs in Python, the need for using special libraries may arise.
For example, when writing a script X.py
you might need to handle operations between matrices and so you would go for the Numpy library, or you may need to read and write raster files and you would go for GDAL library which support raster manipulation.
In the case of Numpy you would simply have to install the library, but for GDAL you would first have to install GDAL utility on your operating system and then install the associated
Python bindings.
Now, to successfully run the script X.py you would need a computer that has Python installed and the associated libraries.
What about making an executable X.exe
out of this script? Could you run it on any Windows OS or you would need Numpy and GDAL installed on that OS to be able to successfully execute it?
Asked
Active
Viewed 116 times
0

multigoodverse
- 7,638
- 19
- 64
- 106
1 Answers
1
You can use something call: PyInstaller, this takes care of all the libraries while packing/building your exe file. All you need is just this .exe and it will work seamlessly on all windows/linux machine.
In a similar post on stack overflow, there was detailed discussion on pyinstaller. Referred here.
-
What about the case of bindings? As I said, GDAL is a program you have to install on your operating system and then Python simply accesses it using some bindings. Furthermore, there are some GDAL functions that are wrapped using os.system(). – multigoodverse Oct 01 '13 at 20:35
-
I have not used GDAL, but i have worked with numpy and few xml modules, dint had to install them in the target machine... You can give it a try and let me know. – Vivek Oct 01 '13 at 20:36