简体   繁体   中英

How can i fix Import TensorFlow error on python 3.7.1?

I'm working on YOLO Object detection on darkflow . Importing tensorflow does pop up an error and the error is following below. I've installed CUDA 10.0 and cuDNN 7.5 for 10.0 still got this issue don't know why and i've tried all the possible solutions.

My system is ASUS GL-502VS GTX1070

>import tensorflow as tf
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in 
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in 
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Anaconda3\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 "", line 1, in 
File "C:\Anaconda3\lib\site-packages\tensorflow_init_.py", line 24, in 
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Anaconda3\lib\site-packages\tensorflow\python_init_.py", line 49, in 
from tensorflow.python import pywrap_tensorflow
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in 
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in 
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in 
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Anaconda3\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.

Try that before running the script:

export CUDA_HOME=/usr/bin/cuda # or /usr/bin/cuda-10, it depends on your installation
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$CUDA_HOME/lib64

first thing open your cmd(windows) or terminal(Linux) and open up python there and then import tensorflow import tensorflow and then if its get imported and run well than it state that you are having wrong python interpreter set for your project or your current interpreter does not have tensorflow install. then in case please change the interpreter or install tensorflow for that interpreter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM