python - Fejl ved import af tensorflow; siger flere moduler mangler

Indlæg af Hanne Mølgaard Plasc

Problem



Jeg installerede tensorflow i Windows 7 (32 bit) med Anaconda i henhold til instruktionerne her. Men når jeg forsøger at importere tensorflow, får jeg følgende fejl: [5]


(tensorflow) C:Usersh473>python
Python 3.5.5 |Anaconda, Inc.| (default, Apr  7 2018, 04:53:16) [MSC v.1900 32 bi
t (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpythonpywrap\_tensorflow\_internal.py", line 18, in swig\_imp
ort\_helper
    fp, pathname, description = imp.find\_module('\_pywrap\_tensorflow\_internal', [
dirname(\_\_file\_\_)])
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibimp.
py", line 297, in find\_module
    raise ImportError(\_ERR\_MSG.format(name), name=name)
ImportError: No module named '\_pywrap\_tensorflow\_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpythonpywrap\_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap\_tensorflow\_internal import *
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpythonpywrap\_tensorflow\_internal.py", line 28, in <module>

    \_pywrap\_tensorflow\_internal = swig\_import\_helper()
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpythonpywrap\_tensorflow\_internal.py", line 20, in swig\_imp
ort\_helper
    import \_pywrap\_tensorflow\_internal
ImportError: No module named '\_pywrap\_tensorflow\_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflow\_\_init\_\_.py", line 24, in <module>
    from tensorflow.python import *
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpython\_\_init\_\_.py", line 49, in <module>
    from tensorflow.python import pywrap\_tensorflow
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpythonpywrap\_tensorflow.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpythonpywrap\_tensorflow\_internal.py", line 18, in swig\_imp
ort\_helper
    fp, pathname, description = imp.find\_module('\_pywrap\_tensorflow\_internal', [
dirname(\_\_file\_\_)])
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibimp.
py", line 297, in find\_module
    raise ImportError(\_ERR\_MSG.format(name), name=name)
ImportError: No module named '\_pywrap\_tensorflow\_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpythonpywrap\_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap\_tensorflow\_internal import *
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpythonpywrap\_tensorflow\_internal.py", line 28, in <module>

    \_pywrap\_tensorflow\_internal = swig\_import\_helper()
  File "C:Usersh473AppDataLocalContinuumanaconda3envs	ensorflowlibsite
-packages	ensorflowpythonpywrap\_tensorflow\_internal.py", line 20, in swig\_imp
ort\_helper
    import \_pywrap\_tensorflow\_internal
ImportError: No module named '\_pywrap\_tensorflow\_internal'


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install\_sources#common\_installation\_probl
ems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
>>>


Jeg prøvede også at installere det som sådan:


pip install tensorflow


Men det installerede ikke engang tensorflow; det giver følgende fejl:


Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow


Foreslå venligst hvad der er problemet og hvordan du løser det.

Bedste reference


Dette er et af spørgsmålene på Tensorflows installationsside under Fælles installationsproblemer -afsnittet, måske kan du prøve de løsninger, der leveres i den sammenkædede SO-spørgsmålet.


Hvad angår pipinstallation, der ikke virker, må du måske prøve: python -m pip install tensorflow.


Håber dette hjælper.