在pycharm中运行tensorflow时出错

时间:2017-11-18 02:47:10

标签: python tensorflow pycharm

我是pycharm, tensorflow and python的新手。我有这个简单的程序:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

要设置tensorflow模块,请按照以下步骤操作:settings > selecte 'Add Local' > selected /home/manish/dev/tensorflow/bin/python3.4。我在/home/manish/dev/tensorflow/

中安装了tensorflow

我收到此错误:

/home/manish/dev/tensorflow/bin/python3.4 /home/manish/PycharmProjects/untitled/test.py
Traceback (most recent call last):
  File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/home/manish/dev/tensorflow/lib/python3.4/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/manish/PycharmProjects/untitled/test.py", line 1, in <module>
    import tensorflow as tf
  File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/home/manish/dev/tensorflow/lib/python3.4/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

Process finished with exit code 1

1 个答案:

答案 0 :(得分:0)

通过终端而不是搜索栏打开Pycharm。

  1. 打开终端
  2. 执行命令:pycharm-community