1. 程式人生 > >window上安裝tensorflow cpu版本

window上安裝tensorflow cpu版本

https://blog.csdn.net/wust_lh/article/details/80408505
下載anaconda的時候,注意選擇python3.5對應的版本。
Anaconda版本:Anaconda3-4.3.0
Python版本:Python 3.6.0
後續的指令是在Anaconda prompt中執行的。

C:\Users\enbo>conda create --name tensorflow python=3.6.0

安裝tf:
pip install --ignore-installed --upgrade tensorflow

安裝後,在命令列中匯入時,出現以下錯誤:

 import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\enbo\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\enbo\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "C:\Users\enbo\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
  File "C:\Users\enbo\Anaconda3\envs\tensorflow\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
ImportError: DLL load failed: 找不到指定的程式。

在自動安裝了tensorflow時, protobuf安裝的是最新版本3.6.1, 出現了不相容的問題。
解決方法:
pip install protobuf==3.6.0