每当我在Windows电脑上尝试导入tensorflow时,python总是在控制台抛出这个错误
import tensorflow
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\AyushSingh\AppData\Local\Programs\Python\Python36\lib\site- packages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\Users\Ayush Singh\AppData\Local\Programs\Python\Python36\lib\site- packages\tensorflow\python\__init__.py", line 52, in <module> from tensorflow.core.framework.graph_pb2 import * File "C:\Users\Ayush Singh\AppData\Local\Programs\Python\Python36\lib\site- packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module> from google.protobuf import descriptor as _descriptor File "C:\Users\Ayush Singh\AppData\Local\Programs\Python\Python36\lib\site- packages\google\protobuf\descriptor.py", line 47, in <module> from google.protobuf.pyext import _message ImportError: DLL load failed: The specified procedure could not be found.
我已经尝试使用pip3卸载并重新安装tensorflow
回答:
我发布了我设置tensorflow在Windows下时的日志,采用的是单独的环境。或许这对你有帮助:
conda create --name tfpy3p6 python=3.6 -yconda activate tfpy3p6conda install -c anaconda cudatoolkit==9.0conda install -c anaconda cudnnpip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.whlconda install ipythonconda install notebook==5.7.5ipython kernel install --user