简体   繁体   English

在Jupyter Notebook中导入TensorFlow失败

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM