[英]Import tensorflow in jupyter notebook fails
When updating tensorflow
to version 1.4, cudnn
to version 6 and setting up SSL encryption and a password on my jupyter notebook server I constantly got the following error in notebooks: 当将tensorflow
更新为1.4版本,将cudnn
更新为6版本并在jupyter笔记本服务器上设置SSL加密和密码时,笔记本中不断出现以下错误:
ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory
Importing tensorflow inside python3 -i
worked fine. 在python3 -i
导入tensorflow效果很好。
I realised that the necessary environment variable LD_LIBRARY_PATH
is set when testing it with echo $LD_LIBRARY_PATH
on the host but print(os.getenv('LD_LIBRARY_PATH'))
in notebooks results in a KeyError
. 我意识到,必要的环境变量LD_LIBRARY_PATH
与测试时,它被设置echo $LD_LIBRARY_PATH
在主机上,但print(os.getenv('LD_LIBRARY_PATH'))
在一个笔记本电脑的结果KeyError
。
Setting the variable in .bashrc
and .profile
didn't change anything. 在.bashrc
和.profile
设置变量不会更改任何内容。
The solution was to run jupyter notebook
with a modified environment with env LD_LIBRARY_PATH=$LD_LIBRARY_PATH jupyter notebook
. 解决的办法是运行jupyter notebook
与一个修改后的环境env LD_LIBRARY_PATH=$LD_LIBRARY_PATH jupyter notebook
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.