ImportError: cannot import name '_get_logger' Niftynet

ImportError: cannot import name '_get_logger' Niftynet

我正在尝试 运行 在我的电脑上使用 Niftynet。但它一直显示此错误。我有一个用于 tensorflow 的 CPU 版本并且它有效。之后我安装了 tensorflow-gpu,现在它停止工作了。

请注意,import tensorflow as tf 工作正常,所以我不确定现在该怎么做才能解决这个问题。

Traceback (most recent call last):
  File "c:\users\halim\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\halim\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\halim\AppData\Local\Programs\Python\Python36\Scripts\net_run.exe\__main__.py", line 5, in <module>
  File "c:\users\halim\appdata\local\programs\python\python36\lib\site-packages\niftynet\__init__.py", line 48, in <module>
    set_logger()
  File "c:\users\halim\appdata\local\programs\python\python36\lib\site-packages\niftynet\io\misc_io.py", line 724, in set_logger
    from tensorflow.python.platform.tf_logging import _get_logger
ImportError: cannot import name '_get_logger' 

您只需安装tensorflow-gpu,并为其安装正确的版本。首先卸载一切:

pip3 uninstall tensorflow-gpu tensorflow

然后重新安装正确的tensorflow-gpu版本

pip3 install --user tensorflow-gpu==1.12

安装指南中提到的版本:https://niftynet.readthedocs.io/en/dev/installation.html