On Windows, running “import tensorflow” generates No module named “_pywrap_tensorflow” error

后端 未结 23 3282
误落风尘
误落风尘 2020-11-22 06:55

On Windows, TensorFlow reports either or both of the following errors after executing an import tensorflow statement:

  • No module named \"_pyw
23条回答
  •  盖世英雄少女心
    2020-11-22 07:19

    For tensorflow with CPU only:


    I had installed tensorflow using command:

    pip3 install --upgrade tensorflow
    

    This installed tensorflow 1.7
    But could not import the tensorflow from withing python 3.6.5 amd64 using:

    import tensorflow as tf
    

    So, i downgraded the tensorflow version from 1.7 to 1.5 using following command:

    pip3 install tensorflow==1.5
    

    This uninstalled the previous version and installed 1.5. Now it works.

    Seems that, my CPU does not support AVX instruction set that is needed in tensorflow 1.7

    I had MSVCP140.DLL in the system folders and .DLL in the PATHEXT variable in Environment Variable.

提交回复
热议问题