安装tensorflow过程中的报错
①安装tensorflow后,测试安装是否成功,结果报错:
SystemError: <built-in method __contains__ of dict object at 0x00000244E83DAFC0> returned a result with an error set

原因:安装tensorflow时没有选择版本(我是输入pip install tensorflow安装的),系统默认安装最新版本2.8,而python版本为3.7,不兼容导致,tensorflow与python版本要对应
解决办法:对tensorflow降级重新安装(pip install tensorflow-GPU==2.5),安装2.5版本的tensorflow,
②安装过程中遇到新报错:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
cryptography 3.3.2 requires cffi>=1.12, but you have cffi 1.11.5 which is incompatible.
百度一下,安装joblib(pip install joblib)和scikit-learn(pip install scikit-learn)后重新安装tensorflow成功

③在Jupyter运行代码时又报错:
module 'keras.engine.base_layer' has no attribute 'BaseRandomLayer'
module 'tensorflow.compat.v2.__internal__.tracking' has no attribute 'no_automatic_dependency_tracking'
重新将tensorflow降级到2.0,keras降级到2.3,tensorflow与keras版本也要对应
④打开anaconda-jupyter运行代码,居然报错找不到包,原因是anaconda不同环境不共享包,
打开cmd,输入jupyter notebook运行,代码运行正常!
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)