Python is a useful scripting language that can be used with Fortran modules to improve flexibility with manipulating certain types of data. A fully-featured development environment can be installed to write and run new Python scripts. However, if the intent is to simply run an existing script, an alternate approach is to run Python from the Cygwin terminal.
Cygwin is a software package that can be used to compile Standalone MESH on Microsoft Windows.
Installing Python with Cygwin
- Download and run the Cygwin installer: setup-x86.exe for 32-bit or setup-x86_64.exe for 64-bit (source: http://cygwin.com/install.html).
- Search for and mark the following packages for installation:
Optionally, include python3 components.
To distinguish between python 2 or 3, include the version when calling python:
- Run "Cygwin Terminal" (mintty.exe)
- Use 'pip' to install additional packages, as required:
pip2 install --upgrade numpy
Running Python from the Cygwin terminal
- To compile an existing Fortran module for Python:
f2py -c -m NAME_OF_FILE NAME_OF_FILE.f90
To run an existing Python script: