我正在尝试安装Python扩展(hydroclimpy.sourceforge.net),它显然需要在安装之前编译一些Fortran。当我为扩展运行build命令时,我最终得到一个错误,告诉我没有找到合适的Fortran编译器:
$ c:/Python27/Python.exe setup.py build
non-existing path in 'scikits\\hydroclimpy': 'hydroclimpyrc.template'
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 "scikits.hydroclimpy.stats._lmoments" sources
f2py options: []
adding 'build\src.win32-2.7\fortranobject.c' to sources.
adding 'build\src.win32-2.7' to include_dirs.
adding 'build\src.win32-2.7\scikits\hydroclimpy\stats\_lmoments-f2pywrappers.f' to sources.
building data_files sources
build_src: building npy-pkg config files
running build_py
running build_ext
No module named msvccompiler in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
customize GnuFCompiler
Found executable C:\cygwin\bin\g77.exe
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
Found executable C:\cygwin\bin\g77.exe
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
Found executable C:\cygwin\bin\f77.exe
absoft: no Fortran 90 compiler found
absoft: no Fortran 90 compiler found
customize CompaqVisualFCompiler
Found executable C:\cygwin\bin\DF.exe
Found executable C:\cygwin\bin\DF.exe
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Found executable C:\cygwin\bin\gfortran.exe
Found executable C:\cygwin\bin\gfortran.exe
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.
building 'scikits.hydroclimpy.stats._lmoments' extension
error: extension 'scikits.hydroclimpy.stats._lmoments' has Fortran sources but no Fortran compiler found
我的机器是带有Cygwin的Windows XP盒子。已安装Setuptools。我已经安装了g95以及我在Cygwin的安装列表中找到的任何其他东西,它看起来与Fortran相关。 / usr / local / bin显示g95和gfortran:
$ ls -l /usr/local/bin/
total 159
lrwxrwxrwx 1 James None 52 Nov 13 14:07 cc1 -> /usr/local/lib/gcc-lib/i686-pc-cygwin/4.1.2/f951.
exe
lrwxrwxrwx 1 James None 37 Nov 13 14:07 g95 -> /usr/local/bin/i686-pc-cygwin-g95.exe
lrwxrwxrwx 1 James None 36 Aug 23 11:54 gfortran -> /usr/local/gfortran/bin/gfortran.exe
-rwxr-xr-x 1 James None 158895 Nov 13 14:07 i686-pc-cygwin-g95.exe
任何人都可以提出其他建议,我可以试着让这台机器上的Fortran情况整理出来,使得这个扩展的安装脚本按预期工作吗?
如果有帮助,此扩展程序的安装脚本位于:
"""
:mod:`scikits.hydroclimpy`
--------------------------
A collection of tools to manipulate environmental and climatologic time series.
setuptools must be installed first. If you do not have setuptools installed
please download and install it from http://pypi.python.org/pypi/setuptools
"""
version = '0.67.1'
classifiers = ['Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS',
'Programming Language :: C',
'Programming Language :: Python',
'Topic :: Education',
'Topic :: Scientific/Engineering',
'Topic :: Software Development',
]
distname = 'scikits.hydroclimpy'
long_description = """
The scikits.hydroclimpy module is a collection of tools for manipulating and
plotting environmental time series of various frequencies. This package is
an extension for scikits.timeseries, focusing on tools for the analysis of
hydroclimatologic datasets.
"""
import os
import sys
import setuptools
from numpy.distutils.core import setup, Extension
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration(None, parent_package, top_path,
namespace_packages=['scikits'])
config.set_options(ignore_setup_xxx_py=True,
assume_default_configuration=True,
delegate_options_to_subpackages=True,
quiet=True,
)
config.add_subpackage('scikits')
config.add_subpackage('doc')
config.add_subpackage('examples')
config.add_subpackage(distname)
config.add_data_files('scikits/__init__.py')
return config
package_data = {'': 'hydroclimpyrc'}
def setup_package():
setup(
install_requires=['numpy > 1.2.5',
'scipy >= 0.7',
'scikits.timeseries >= 0.91'],
namespace_packages=['scikits'],
packages=setuptools.find_packages(),
test_suite = 'nose.collector',
name = distname,
version = version,
description = "Environmental time series manipulation",
long_description = long_description,
license = "BSD",
author = "Pierre GF GERARD-MARCHANT",
author_email = "pierregmcode_AT_gmail_DOT_com",
maintainer = "Pierre GF GERARD-MARCHANT",
maintainer_email = "pierregmcode_AT_gmail_DOT_com",
url = "http://hydroclimpy.sourceforge.net",
classifiers = classifiers,
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
configuration = configuration,
)
return
if __name__ == '__main__':
setup_package()
答案 0 :(得分:0)
来自不同倾向的替代建议:避免像cygwin这样的问题的一种方法,并尝试在XP机器上获得类似环境的* nix就是采取行动并使用linux。有很多方法可以做到这一点,包括双启动,现场Linux,或者只是去做吧。
答案 1 :(得分:0)
您可能想尝试在this python bug中应用补丁,这样我就可以在遇到您描述的完全相同的错误后从源代码构建numpy。
注意:我正在使用VS2010进行编译,你也应该为所有的python扩展使用它。