tensorflow使用中遇到的问题

【关键词:TensorFlow问题】
==========================================================================================
C:\Users\Administrator\anaconda3\python.exe D:/Users/Administrator/PycharmProjects/MachineLearning/00.practice/test2.py
Traceback (most recent call last):
  File "C:\Users\Administrator\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/Users/Administrator/PycharmProjects/MachineLearning/00.practice/test2.py", line 52, in <module>
    import tensorflow as tf
  File "C:\Users\Administrator\anaconda3\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\Administrator\anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context
  File "C:\Users\Administrator\anaconda3\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
    from tensorflow.python import pywrap_tfe
  File "C:\Users\Administrator\anaconda3\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Administrator\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\Administrator\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 找不到指定的模块。


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

Process finished with exit code 1
==========================================================================================

解决方法在这里:

https://blog.csdn.net/sereasuesue/article/details/105327611?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control

https://support.microsoft.com/zh-cn/topic/%E6%9C%80%E6%96%B0%E6%94%AF%E6%8C%81%E7%9A%84-visual-c-%E4%B8%8B%E8%BD%BD-2647da03-1eea-4433-9aff-95f26a218cc0
==========================================================================================


【关键词:TensorFlow问题2】
C:\Users\Administrator\anaconda3\python.exe D:/Users/Administrator/PycharmProjects/MachineLearning/02.deepLearning/01.TensorFlow基础/01.tensorflow图创建.py
2021-08-12 08:02:36.806000: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-08-12 08:02:36.807000: 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.
2021-08-12 08:02:48.019000: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2021-08-12 08:02:48.019000: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-08-12 08:02:48.025000: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: WuBin
2021-08-12 08:02:48.026000: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: WuBin
2021-08-12 08:02:48.144000: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
  File "D:/Users/Administrator/PycharmProjects/MachineLearning/02.deepLearning/01.TensorFlow基础/01.tensorflow图创建.py", line 8, in <module>
    print("当前图为2{}".format(tf.get_default_graph()))
AttributeError: module 'tensorflow' has no attribute 'get_default_graph'
==========================================================================================
解决方法:
https://github.com/keras-team/keras/issues/12379
原来是这个方法已经放在了别的模块里面
但最好还是不要安装高版本的TensorFlow


说到底,高版本的TensorFlow会有各种各样的问题,用低版本,用低版本,用低版本!!! 准确地说是 1.13.1


【关键词:安装TensorFlow 1.13.1】

(base) C:\Users\Administrator>pip install tensorflow==1.13.1 -i https://pypi.tuna.tsinghua.edu.cn/simple/
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out'))': /simple/tensorflo
ERROR: Could not find a version that satisfies the requirement tensorflow==1.13.1 (from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2,
, 2.3.3, 2.3.4, 2.4.0rc0, 2.4.0rc1, 2.4.0rc2, 2.4.0rc3, 2.4.0rc4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0, 2.5.1, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0)
ERROR: No matching distribution found for tensorflow==1.13.1

没有这个版本的TensorFlow? 不是没有,而是我的python/pip版本对应的TensorFlow中,没有这个TensorFlow版本。

那么解决方法是:
1. 卸载python3.8
2. 安装python3.6
然后继续安装tensorflow==1.13.1

https://www.jb51.net/article/195387.htm    为什么要退回python3.6,这里有解释。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值