【问题标题】:'f2py -c --help-fcompiler' hangs'f2py -c --help-fcompiler' 挂起
【发布时间】:2019-01-30 09:52:52
【问题描述】:

当我运行命令时

f2py --c -help-fcompiler

f2py 打印以下输出,然后无限期挂起

Gnu95FCompiler instance properties:
  archiver        = ['/usr/bin/gfortran', '-cr']
  compile_switch  = '-c'
  compiler_f77    = ['/usr/bin/gfortran', '-Wall', '-g', '-ffixed-form', '-
                    fno-second-underscore', '-fPIC', '-O3', '-funroll-loops']
  compiler_f90    = ['/usr/bin/gfortran', '-Wall', '-g', '-fno-second-
                    underscore', '-fPIC', '-O3', '-funroll-loops']
  compiler_fix    = ['/usr/bin/gfortran', '-Wall', '-g', '-ffixed-form', '-
                    fno-second-underscore', '-Wall', '-g', '-fno-second-
                    underscore', '-fPIC', '-O3', '-funroll-loops']
  libraries       = ['gfortran']
  library_dirs    = ['/usr/lib/gcc/x86_64-linux-gnu/7', '/usr/lib/gcc/x86_64
                    -linux-gnu/7']
  linker_exe      = ['/usr/bin/gfortran', '-Wall', '-Wall']
  linker_so       = ['/usr/bin/gfortran', '-Wall', '-g', '-Wall', '-g', '-
                    shared']
  object_switch   = '-o '
  ranlib          = ['/usr/bin/gfortran']
  version         = LooseVersion ('7')
  version_cmd     = ['/usr/bin/gfortran', '-dumpversion']

当我使用 ctrl+c 手动终止进程时,它看起来像是卡在了这里:

TEST_ENV/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 472, in customize
    posix=(os.name == 'posix'))
  File "/usr/lib/python3.6/shlex.py", line 305, in split
    return list(lex)
  File "/usr/lib/python3.6/shlex.py", line 295, in __next__
    token = self.get_token()
  File "/usr/lib/python3.6/shlex.py", line 105, in get_token
    raw = self.read_token()
  File "/usr/lib/python3.6/shlex.py"

这一切都在使用 numpy 1.16.0 的干净虚拟环境中

有人知道为什么会这样吗?

【问题讨论】:

    标签: python numpy fortran gfortran f2py


    【解决方案1】:

    这是 numpy 中的一个已知错误(已修复并向后移植到 1.16.1):

    https://github.com/numpy/numpy/pull/12843

    原因

    f2py -c --help-compiler
    

    在 Ubuntu 18.04 上无限期挂起是由于在 None 上调用了 shlex.split()

    show_fcompilers() 调用customize()self.command_vars.compiler_f77 = f77self.command_vars.compiler_f90 = None 时,这发生在fcompiler/__init__.py 的第471 行

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-17
      • 1970-01-01
      • 2021-03-22
      • 2015-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多