从桌面条目或启动器使用PyCharm时TensorFlow不导入

时间:2017-02-16 09:41:18

标签: python ubuntu import tensorflow pycharm

TensorFlow已正确安装在我的计算机上,我可以导入它并在终端中运行代码,PyCharm(从终端窗口用pycharm.sh命令打开)和其他编辑器。

但是,如果我从Launcher启动PyCharm,导入TensorFlow时会出现以下错误

ImportError: No module named _pywrap_tensorflow

我删除了jetbrains-pycharm-ce.desktop并通过工具重新创建了它 - >多次创建桌面条目。我还尝试从终端打开PyCharm pycharm.sh并将打开的应用程序锁定到Launcher。无论我做什么,PyCharm通过任何GUI方法打开都无法导入TensorFlow。

我比较了PyCharm中的所有运行设置和所有内容,并且无法找到任何差异。

当PyCharm未通过命令行打开时,有什么不允许我导入TensorFlow?

以下是我在PyCharm中获得的整个错误代码块。

import tensorflow as tf
Traceback (most recent call last):
  File "/opt/miniconda2/envs/tensorflow/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-41389fad42b5>", line 1, in <module>
    import tensorflow as tf
  File "/opt/pycharm-community-2016.3.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/miniconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/opt/pycharm-community-2016.3.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/miniconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/opt/pycharm-community-2016.3.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/miniconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 17, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/opt/miniconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 16, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow')
  File "/opt/miniconda2/envs/tensorflow/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/pycharm-community-2016.3.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ImportError: No module named _pywrap_tensorflow

0 个答案:

没有答案