f2pyc过程帮助编译器fcompiler挂起

2024-05-14 18:54:01 发布

您现在位置:Python中文网/ 问答频道 /正文

当我运行命令时

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"

这都是在一个干净的虚拟环境中使用numpy1.16.0

有人知道为什么会这样吗


Tags: inpytokenbincompilerlibusrline
1条回答
网友
1楼 · 发布于 2024-05-14 18:54:01

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

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

原因是什么

f2py -c  help-compiler

在ubuntu18.04上无限期挂起是由于shlex.split()None上被调用

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

相关问题 更多 >

    热门问题