title: F2PY returns ValueError: invalid version number '4.'
body: <p>I am new to Python and want to be able to use my existing Fortran code and run it from Python. I am trying to compile a small "Hello world" Fortran program using F2PY by following instructions online.</p>
  
  <p>I am working on Windows. So far I have installed Python 2.7.3, NumPy 1.6.1, SciPy 10.1, and MinGW 4.8.</p>
  
  <p>I then tried (amongst other things)</p>
  
  <pre><code>f2py.py -c --compiler=mingw32 --fcompiler=gnu95 -m foo foo.f90
  </code></pre>
  
  <p>This reports an invalid version number. </p>
  
  <blockquote>
    <p>ValueError: invalid version number '4.'</p>
  </blockquote>
  
  <p>If anyone could suggest what is going wrong and what I would need to change to get this to run I would be most grateful. The full output from F2PY is follows:</p>
  
  <pre><code>D:\python\fortran2&gt;f2py.py -c --compiler=mingw32 --fcompiler=gnu95 -m foo foo.f90
  running build
  running config_cc
  unifing config_cc, config, build_clib, build_ext, build commands --compiler options
  running config_fc
  unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
  running build_src
  build_src
  building extension "foo" sources
  f2py options: []
  f2py:&gt; c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7\foomodule.c
  creating c:\docume~1\ajr\locals~1\temp\tmpwvnr2c
  creating c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7
  Reading fortran codes...
          Reading file 'foo.f90' (format:free)
  Post-processing...
          Block: foo
                          Block: hello
  Post-processing (stage 2)...
  Building modules...
          Building module "foo"...
                  Constructing wrapper function "hello"...
                    hello()
          Wrote C/API module "foo" to file "c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7\foomodule.c"
    adding 'c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7\fortranobject.c' to sources.
  adding 'c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7' to include_dirs.
  copying C:\Python27\lib\site-packages\numpy\f2py\src\fortranobject.c -&gt; c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7
  copying C:\Python27\lib\site-packages\numpy\f2py\src\fortranobject.h -&gt; c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7
  build_src: building npy-pkg config files
  running build_ext
  Traceback (most recent call last):
    File "c:\python27\scripts\f2py.py", line 24, in &lt;module&gt;
      main()
    File "C:\Python27\lib\site-packages\numpy\f2py\f2py2e.py", line 588, in main
      run_compile()
    File "C:\Python27\lib\site-packages\numpy\f2py\f2py2e.py", line 574, in run_compile
      setup(ext_modules = [ext])
    File "C:\Python27\lib\site-packages\numpy\distutils\core.py", line 186, in setup
      return old_setup(**new_attr)
    File "C:\Python27\lib\distutils\core.py", line 152, in setup
      dist.run_commands()
    File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
      cmd_obj.run()
    File "C:\Python27\lib\site-packages\numpy\distutils\command\build.py", line 37, in run
      old_build.run(self)
    File "C:\Python27\lib\distutils\command\build.py", line 127, in run
   self.run_command(cmd_name)
    File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
      cmd_obj.run()
    File "C:\Python27\lib\site-packages\numpy\distutils\command\build_ext.py", line 92, in run
      force=self.force)
    File "C:\Python27\lib\site-packages\numpy\distutils\ccompiler.py", line 556, in new_compiler
      compiler = klass(None, dry_run, force)
    File "C:\Python27\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 127, in __init__
      elif self.gcc_version &lt; "4.":
    File "C:\Python27\lib\distutils\version.py", line 138, in __cmp__
      other = StrictVersion(other)
    File "C:\Python27\lib\distutils\version.py", line 40, in __init__
      self.parse(vstring)
    File "C:\Python27\lib\distutils\version.py", line 107, in parse
      raise ValueError, "invalid version number '%s'" % vstring
  ValueError: invalid version number '4.'
  </code></pre>