|
The following notes are from Eric Jones. |
|
|
|
My Setup: |
|
|
|
For Python/Fortran development, I run Windows 2000 and use the mingw32 |
|
(www.mingw.org) set of gcc/g77 compilers and tools (gcc 2.95.2) to build python |
|
extensions. I'll also ocassionally use MSVC for extension development, but |
|
rarely on projects that include Fortran code. This short HOWTO describes how |
|
I use f2py in the Windows environment. Pretty much everything is done from |
|
a CMD (DOS) prompt, so you'll need to be familiar with using shell commands. |
|
|
|
Installing f2py: |
|
|
|
Before installing f2py, you'll need to install python. I use python2.1 (maybe |
|
python2.2 will be out by the time you read this). Any version of Python beyond |
|
version 1.52 should be fine. See www.python.org for info on installing Python. |
|
|
|
You'll also need Numeric which is available at |
|
http://sourceforge.net/projects/numpy/. The latest version is 20.3. |
|
|
|
Since Pearu has moved to a setup.py script, installation is pretty easy. You |
|
can download f2py from http://cens.ioc.ee/projects/f2py2e/. The latest public |
|
release is http://cens.ioc.ee/projects/f2py2e/rel-3.x/f2py-3.latest.tgz. Even |
|
though this is a .tgz file instead of a .zip file, most standard compression |
|
utilities such as WinZip (www.winzip.com) handle unpacking .tgz files |
|
automatically. Here are the download steps: |
|
|
|
1. Download the latest version of f2py and save it to disk. |
|
|
|
2. Use WinZip or some other tool to open the "f2py.xxx.tgz" file. |
|
a. When WinZip says archive contains one file, "f2py.xxx.tar" |
|
and ask if it should open it, respond with "yes". |
|
b. Extract (use the extract button at the top) all the files |
|
in the archive into a file. I'll use c:\f2py2e |
|
|
|
3. Open a cmd prompt by clicking start->run and typing "cmd.exe". |
|
Now type the following commands. |
|
|
|
C:\WINDOWS\SYSTEM32> cd c:\f2py2e |
|
C:\F2PY2E> python setup.py install |
|
|
|
This will install f2py in the c:\python21\f2py2e directory. It |
|
also copies a few scripts into the c:\python21\Scripts directory. |
|
Thats all there is to installing f2py. Now lets set up the environment |
|
so that f2py is easy to use. |
|
|
|
4. You need to set up a couple of environement variables. The path |
|
"c:\python21\Scripts" needs to be added to your path variables. |
|
To do this, go to the enviroment variables settings page. This is |
|
where it is on windows 2000: |
|
|
|
Desktop->(right click)My Computer->Properties->Advanced-> |
|
Environment Variables |
|
|
|
a. Add "c:\python21\Scripts" to the end of the Path variable. |
|
b. If it isn't already there, add ".py" to the PATHEXT variable. |
|
This tells the OS to execute f2py.py even when just "f2py" is |
|
typed at a command prompt. |
|
|
|
5. Well, there actually isn't anything to be done here. The Python |
|
installation should have taken care of associating .py files with |
|
Python for execution, so you shouldn't have to do anything to |
|
registry settings. |
|
|
|
To test your installation, open a new cmd prompt, and type the following: |
|
|
|
C:\WINDOWS\SYSTEM32> f2py |
|
Usage: |
|
f2py [<options>] <fortran files> [[[only:]||[skip:]] \ |
|
<fortran functions> ] \ |
|
[: <fortran files> ...] |
|
... |
|
|
|
This prints out the usage information for f2py. If it doesn't, there is |
|
something wrong with the installation. |
|
|
|
Testing: |
|
The f2py test scripts are kinda Unix-centric, so they don't work under windows. |
|
|
|
XXX include test script XXX. |
|
|
|
Compiler and setup.py issues: |
|
|
|
XXX |
|
|