让这玩意整疯魔了
记录下
我的环境:win10+python3.7.3+anaconda 3
现在还要加个电脑cpu是i5 7代了
Using TensorFlow backend.
Traceback (most recent call last):
File "F:\python\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "F:\python\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "F:\python\Anaconda\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 "F:\python\Anaconda\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "F:\python\Anaconda\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:/论文/其他文件/深度学习项目/fastrcnn文件/keras-frcnn-master/keras-frcnn-master/train_frcnn.py", line 10, in <module>
from keras import backend as K
File "F:\python\Anaconda\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import activations
File "F:\python\Anaconda\lib\site-packages\keras\activations.py", line 3, in <module>
from . import backend as K
File "F:\python\Anaconda\lib\site-packages\keras\backend\__init__.py", line 73, in <module>
from .tensorflow_backend import *
File "F:\python\Anaconda\lib\site-packages\keras\backend\tensorflow_backend.py", line 1, in <module>
import tensorflow as tf
File "F:\python\Anaconda\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
from tensorflow_core import *
File "F:\python\Anaconda\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "F:\python\Anaconda\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "F:\python\Anaconda\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "F:\python\Anaconda\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "F:\python\Anaconda\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "F:\python\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "F:\python\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "F:\python\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "F:\python\Anaconda\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 "F:\python\Anaconda\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "F:\python\Anaconda\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。
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.
详细错误长这样,
然后我去查了下发现了这样的惊喜
https://stackoverflow.com/questions/42011070/on-windows-running-import-tensorflow-generates-no-module-named-pywrap-tenso
In my case the “cudnn64_6.dll” file in the /bin folder had to be renamed to “cudnn64_5.dll” for the error to go away. I easily spent two hours to figure this out, and I followed the official install guide to the letter. This is true for installation via pip (officially supported) and conda (community supported).
This was my case. TensorFlow requires “cuDNN v5.1” but if you install cuDNN v6.0, then the file name of the cudnn dll file will be cudnn64_6.dll not cudnn64_5.dll. – Naetmul Jun 13 at 12:17
好巧哦,windows下支持的是python 3.5…的版本,而我的环境是python3.7.3。于是我觉得不行,继续查,好der,发现win10下支持python3.6…的版本了。再然后
膜拜大佬
这个方法安装tensorflow那部分尤其有用,我也确实安装了,检测也确实安装好了,但是导入时候又失败了,出现了这个错误:
DLL load failed: 找不到指定的模块
继续懵逼,然后:
引用错误解决方法
电脑的cpu是i5 7代,cpu太老了
所以需要降低tensorflow的版本
pip uninstall tensorflow
pip install tensorflow==2.0.0
然后导入:
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow.contrib'
看到了这个:
tensortflow2.0以后版本删除该模块的解决方法
继续:
pip uninstall tensorflow
pip install tensorflow==1.14.0
cmd里可以用了,测试下pycharm
是路径的错误了,不是tensorflow的错误了,nice! 我活过来了。
注:直接pip下载不了的话可以尝试使用镜像,比如说如下:
pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com tensorflow==1.14.0
亲测好用
感谢各位大佬指教。