使用tensorflow时获取错误消息

问题描述 投票:1回答:1

我已经使用pip命令安装了tensorflow。但是每当我尝试通过导入在代码中使用它时,都会出现错误。我不知道为什么会收到此错误。也无法使用tflearn。我最近也刚开始用python编码。这是错误消息:

适当的视图:https://justpaste.it/56znr

Traceback (most recent call last):
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
from tensorflow_core import *
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

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

这是我检查安装是否正确的方法:

C:\Users\Aaman>pip show tensorflow     
Name: tensorflow     
Version: 2.1.0       
Summary: TensorFlow is an open source machine learning framework for everyone.   
Home-page: https://www.tensorflow.org/     
Author: Google Inc.      
Author-email: [email protected]        
License: Apache 2.0        
Location: c:\users\aaman\anaconda3\envs\chatbot\lib\site-packages      
Requires: protobuf, scipy, keras-applications, keras-preprocessing, absl-py, tensorboard, wrapt, opt-einsum, google-pasta, astor, numpy, tensorflow-estimator, six, wheel, grpcio, gast, termcolor
Required-by:
python tensorflow machine-learning chatbot tflearn
1个回答
0
投票

您需要从here下载并安装/更新Microsoft Visual C ++ 2015-2019可再发行版本(x64)。

如果您遇到任何其他问题,可能的原因是

  • 您的CPU不支持AVX2指令
  • 您的CPU / Python使用的是32位
  • [位于其他位置的库/未安装在系统上的库无法加载。

请参考Windows CPUGPU的经过测试的内部配置。

© www.soinside.com 2019 - 2024. All rights reserved.