我似乎无法将tensorflow导入python VSCODE

时间:2018-11-23 16:11:49

标签: python tensorflow visual-studio-code pip

回溯(最近通话过去):

File "d:\kuliah\aa\aaa\aaaa\bpnn.py", line 1, in <module>
    import tensorflow as tf

File "C:\Users\xxx\AppData\Roaming\Python\Python36\sitepackages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import

File "C:\Users\xxx\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\__init__.py", line 59, in <module> from tensorflow.core.framework.graph_pb2 import *

File "C:\Users\xxx\AppData\Roaming\Python\Python36\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor

File "C:\Program Files\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.

当我在.py代码上导入我的tensorflow时,发生了什么?

1 个答案:

答案 0 :(得分:0)

出现此问题是因为扩展名VScodeCoderunner无法激活您正在使用的conda环境。要解决此问题。

  1. 开始anaconda command prompt,然后输入activate <your environment name>
  2. 键入code以启动VSCode。您的导入现在应该可以正常工作了。

谢谢!