问题
System Information:
Windows 10
Python 3.6.4 and 3.7.0 <- default version
Tensorflow 1.11.0
Conda 4.7.12
pip 19.3.1
I was trying to get Tensorflow 2.0 running on Windows 10, but my computer doesn't support the AVX/AVX2 instruction set, so I used a wheel supporting SSE2 instead, which I installed with pip.
I then procceded to attempting to run the python code from the MINST Basic classification tutorial from Tensorflow's official website:
from __future__ import absolute_import, division, print_function, unicode_literals
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras
# Helper libraries
import numpy as np
import matplotlib.pyplot as plt
print(tf.__version__)
Whem I tried to run the file, I was given this error:
ImportError: DLL load failed: The specified module could not be found.
This was the whole error, though (intro.py is the name of the file):
(base) C:\Users\XXX\Desktop\NN\TF\Intro>python intro.py
Traceback (most recent call last):
File "C:\Users\XXX\Miniconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\XXX\Miniconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\XXX\Miniconda3\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\XXX\Miniconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\XXX\Miniconda3\lib\imp.py", line 342, 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 "intro.py", line 4, in <module>
import tensorflow as tf
File "C:\Users\XXX\Miniconda3\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
from tensorflow_core import *
File "C:\Users\XXX\Miniconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\XXX\Miniconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\Users\XXX\Miniconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Users\XXX\Miniconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\XXX\Miniconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\XXX\Miniconda3\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\XXX\Miniconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\XXX\Miniconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\XXX\Miniconda3\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\XXX\Miniconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\XXX\Miniconda3\lib\imp.py", line 342, 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
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I have tried and gotten the exsct same error on:
pip
anaconda (miniconda) both in and out of an environment
I do not have Cuda or cudNN as I have a crappy CPU and an on-board intel GPU, meaning I can't use tensorflow-gpu. I have also tried all the aforementioned options on both Python 3.6.4 and Python 3.7.0 to no avail. i would use an official version, but I have no devices that support AVX/AVX2. If I can't fix the issue, I will try on Linux (I have already tried, though, and gave up) or downgrading to a version which supports SSE2.
回答1:
I had the same issue, but it was resolved by installing https://aka.ms/vs/16/release/VC_redist.x64.exe instead of https://www.microsoft.com/en-us/download/details.aspx?id=53587. May needed a newer Microsoft Visual C++ Redistributable?
If you have another questions, Ask https://github.com/fo40225/tensorflow-windows-wheel/issues.
Tensorflow 2.0 working on my pentium n4200 by using https://github.com/fo40225/tensorflow-windows-wheel/tree/master/2.0.0/py37/CPU/sse2.
It might be better to uninstall tensorflow1.11.0 and then install tensorflow2.0(SSE2)
I'm using Vanilla python(python.org) environment, not anaconda's.
来源:https://stackoverflow.com/questions/59593972/tensorflow-2-0-on-windows-sse2-how-do-you-stop-importerror-dll-load-failed