gpt4 book ai didi

python - 由于在 Cygwin 中找不到合适的 Fortran 编译器,我该如何解决这个失败的 Python 扩展构建?

转载 作者:行者123 更新时间:2023-11-28 19:25:50 26 4
gpt4 key购买 nike

我正在尝试安装一个 Python 扩展 (hydroclimpy.sourceforge.net),它显然需要在安装之前将一些 Fortran 语言编译到自身中。当我运行扩展的构建命令时,我得到一个错误,告诉我没有找到合适的 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 机器。安装工具已安装。我已经安装了 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()

最佳答案

来自不同角度的替代建议:避免像 cygwin 这样的问题,并尝试在 XP 机器上获得类似 *nix 的环境的一种方法是尝试使用 linux。有很多方法可以做到这一点,包括双启动、live linux,或者直接去做。

关于python - 由于在 Cygwin 中找不到合适的 Fortran 编译器,我该如何解决这个失败的 Python 扩展构建?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13424337/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com