问题描述
我在 pycharm 上遇到 tensorflow 问题.
I have an issues with tensorflow on pycharm.
每当我在 linux 终端中导入 tensorflow 时,它都能正常工作.但是,在 PyCharm 社区 2017.1 中,它显示:
Whenever I import tensorflow in the linux terminal, it works correctly. However, in PyCharm community 2017.1, it shows:
导入错误:libcudnn.so.5:无法打开共享对象文件:没有这样的文件或目录
ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory
有关如何解决问题的任何提示.
Any hint on how to tackle the issue.
请注意,我使用的是 python 3.5.2、tensorflow 1.1.0、Cuda 8 和 CuDnn 5.1
Please note that I am using python 3.5.2, tensorflow 1.1.0, Cuda 8 and CuDnn 5.1
打印 sys.path 时,我在 PyCharm 中得到了这个:
when printing sys.path, I get this in PyCharm:
['/home/xxx/pycharm-community-2017.1.2/helpers/pydev'、'/home/xxx/pycharm-community-2017.1.2/helpers/pydev'、'/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.5/dist-packages/IPython/extensions', '/home/xxx/xxx/xxx']
['/home/xxx/pycharm-community-2017.1.2/helpers/pydev', '/home/xxx/pycharm-community-2017.1.2/helpers/pydev', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.5/dist-packages/IPython/extensions', '/home/xxx/xxx/xxx']
在终端中:['', '/usr/local/bin', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.5/dist-packages/IPython/extensions', '/home/xxx/.ipython']
and this in the terminal:['', '/usr/local/bin', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.5/dist-packages/IPython/extensions', '/home/xxx/.ipython']
推荐答案
解决方案是:
- 从控制台运行 PyCharm.或
- 在IDE设置中添加环境变量:LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
这篇关于Tensorflow 和 Pycharm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!