操作系统:MacOS Monterey 12.6.5
编程环境:conda create -n tf python=3.9
错误描述:导入 TensorFlow GPU 时,键入“import tensorflow as tf”后出现
AttributeError: partially initialized module ‘charset_normalizer’ has
no attribute ‘md__mypyc’ (most likely due to a circular import)
修复方法:
pip install --force-reinstall charset-normalizer==3.1.0
修复结果:
[>>>tf.version
‘2.10.0’
在MacOSMonterey12.6.5环境下,使用conda创建的python3.9环境中,尝试导入TensorFlowGPU时遇到AttributeError,具体为charset_normalizer模块部分初始化且无md__mypyc属性,可能由循环导入引起。通过运行pipinstall--force-reinstallcharset-normalizer==3.1.0进行修复,成功后确认TensorFlow版本为2.10.0。
645





