python - Anaconda + Spyder + Windows Tensorflow installation

Indlæg af Hanne Mølgaard Plasc

Problem



Emnet beskriver problemet. Jeg kan ikke installere TF og bruge det i Anaconda withtin Spyder IDE på Windows. Installation af TF GPU v0.12.1 inden for dette script afsluttes med succes:


pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow\_gpu-0.12.1-cp35-cp35m-win\_amd64.whl


Jeg får dog stadig denne fejl:


 Traceback (most recent call last):

  File "<ipython-input-1-a2e3a001c740>", line 1, in <module>
    runfile('D:/ERP/SRC/WorkloadPrediction/PythonScripts/test\_pys/test\_TF.py', wdir='D:/ERP/SRC/WorkloadPrediction/PythonScripts/test\_pys')

  File "D:ProgramsAnaconda3libsite-packagesspyderutilssitesitecustomize.py", line 866, in runfile
    execfile(filename, namespace)

  File "D:ProgramsAnaconda3libsite-packagesspyderutilssitesitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/ERP/SRC/WorkloadPrediction/PythonScripts/test\_pys/test\_TF.py", line 8, in <module>
    import tensorflow as tf

  File "D:ProgramsAnaconda3libsite-packages	ensorflow\_\_init\_\_.py", line 24, in <module>
    from tensorflow.python import *

  File "D:ProgramsAnaconda3libsite-packages	ensorflowpython\_\_init\_\_.py", line 60, in <module>
    raise ImportError(msg)

ImportError: Traceback (most recent call last):
  File "D:ProgramsAnaconda3libsite-packages	ensorflowpythonpywrap\_tensorflow.py", line 18, in swig\_import\_helper
    return importlib.import\_module(mname)
  File "D:ProgramsAnaconda3libimportlib\_\_init\_\_.py", line 126, in import\_module
    return \_bootstrap.\_gcd\_import(name[level:], package, level)
  File "<frozen importlib.\_bootstrap>", line 986, in \_gcd\_import
  File "<frozen importlib.\_bootstrap>", line 969, in \_find\_and\_load
  File "<frozen importlib.\_bootstrap>", line 958, in \_find\_and\_load\_unlocked
  File "<frozen importlib.\_bootstrap>", line 666, in \_load\_unlocked
  File "<frozen importlib.\_bootstrap>", line 577, in module\_from\_spec
  File "<frozen importlib.\_bootstrap\_external>", line 906, in create\_module
  File "<frozen importlib.\_bootstrap>", line 222, in \_call\_with\_frames\_removed
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:ProgramsAnaconda3libsite-packages	ensorflowpython\_\_init\_\_.py", line 54, in <module>
    from tensorflow.python import pywrap\_tensorflow
  File "D:ProgramsAnaconda3libsite-packages	ensorflowpythonpywrap\_tensorflow.py", line 21, in <module>
    \_pywrap\_tensorflow = swig\_import\_helper()
  File "D:ProgramsAnaconda3libsite-packages	ensorflowpythonpywrap\_tensorflow.py", line 20, in swig\_import\_helper
    return importlib.import\_module('\_pywrap\_tensorflow')
  File "D:ProgramsAnaconda3libimportlib\_\_init\_\_.py", line 126, in import\_module
    return \_bootstrap.\_gcd\_import(name[level:], package, level)
ImportError: No module named '\_pywrap\_tensorflow'


Error importing tensorflow.  Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.


Jeg sikrede, at Visual C ++ x64 2015 Redist er installeret. Også forsøgt en masse geninstallationer, genstarter, google løsninger osv., Men intet hjælper.


Prøv at køre dette script:


import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))


Kan du venligst rådgive noget?


Mange tak!
Artemiy

Bedste reference


Fejlmeddelelsen er klar, du skal initialisere TensorFlow udenfor sin mappe. Hvis det ikke er dit problem, skal du kontrollere, om du har installeret MSVCP140.dll i dit system (se BEMÆRK under Pip Installation på Windows) i betragtning af din Cuda og cuDNN er installeret korrekt, og deres mapper er indstillet på din [[\%PATH\%. [7]

Andre referencer 1


Opdater TensorFlow med


pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow\_gpu-0.12.1-cp35-cp35m-win\_amd64.whl