python - TensorFlow 在导入期间失败:“ImportError: cannot import name 'mirrored_strategy_with_two_gpus_no_merge_call'”
问题描述
我在 Windows 10 笔记本电脑上使用 Python 3.8.10 版从 Anaconda 虚拟环境运行 TensorFlow 2.3.0 版。venv 已设置并运行良好,直到 IDE 在导入时开始抛出以下错误:
2021-08-04 19:12:57.977474: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2021-08-04 19:12:57.979433: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "C:\Users\zachary.holden\Documents\Python-Scripts\SpeakerIdentification\SpeakerIdentification.py", line 4, in <module>
import tensorflow as tf
File "C:\Users\zachary.holden\AppData\Roaming\Python\Python38\site-packages\tensorflow\__init__.py", line 49, in <module>
from ._api.v2 import __internal__
File "C:\Users\zachary.holden\AppData\Roaming\Python\Python38\site-packages\tensorflow\_api\v2\__internal__\__init__.py", line 13, in <module>
from . import distribute
File "C:\Users\zachary.holden\AppData\Roaming\Python\Python38\site-packages\tensorflow\_api\v2\__internal__\distribute\__init__.py", line 10, in <module>
from . import combinations
File "C:\Users\zachary.holden\AppData\Roaming\Python\Python38\site-packages\tensorflow\_api\v2\__internal__\distribute\combinations\__init__.py", line 20, in <module>
from tensorflow.python.distribute.strategy_combinations import mirrored_strategy_with_two_gpus_no_merge_call
ImportError: cannot import name 'mirrored_strategy_with_two_gpus_no_merge_call' from 'tensorflow.python.distribute.strategy_combinations'
我尝试完全卸载并重新安装 Anaconda3,但同样的错误仍然存在。我的计算机上没有 GPU 设置,尽管这在过去似乎不是问题。这是版本兼容性问题吗?
此外,我尝试了这个问题中提出的解决方案,看起来很相似,但问题仍然存在。
解决方案
推荐阅读
- python - Keras 信号处理模型
- jquery - 从 Jquery 数据表中清除自定义过滤器
- c++ - 使用 Windows 中的 GetKeyName() 函数在 C++ 中即时切换键盘布局
- sql - 为什么我的临时表不会填充数据,但其中的 select 语句会?
- node.js - ReferenceError: [tablename] 未定义 | Node.js、Express、Axios、PostgreSQL
- c# - 如何确保用户不会尝试输入已经存在的主键 ID?
- css - 如何根据最大选项宽度设置反应选择宽度?
- json - 如何通过 jq 获取数字对象属性的值?
- java - 在 eclipse 中查找 lombok 生成的构建器的用法
- sql - 在所有组织sql中显示全名医生