【问题标题】:Running tensorflow with tmux on Ubuntu server error在 Ubuntu 服务器上使用 tmux 运行 tensorflow 错误
【发布时间】:2018-08-04 07:44:18
【问题描述】:

我正在尝试使用 tmux 运行深度学习程序。但是,似乎 tensorflow 不可用。

要启动我运行的 tmux 环境:

ubuntu@ip-xxx-xx-x-xx:~/xxxx/xxxx$ tmux

然后在我运行的tmux环境里面:

ubuntu@ip-xxx-xx-x-xx:~/xxxx/xxxx$ source activate tensorflow_p36
(tensorflow_p36) ubuntu@ip-xxx-xx-x-xx:~/xxxx/xxxx$ python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'

导入 tensorflow 以外的其他包(例如 PIL 或 cv2)可以正常工作。在 tmux 环境之外导入 tensorflow 是可行的。

我在 ubuntu 16 AWS 服务器上运行它。可能是什么问题?

【问题讨论】:

  • 您确定 tensorflow 已安装在您的虚拟环境中吗?
  • 当您说虚拟环境时,您是指在 tmux 内部吗?在tmux之外导入tensorflow是没有问题的。
  • 是的,请检查没有 tmux,source activate tensorflow_p36 我想这是您正在激活虚拟环境。
  • 我明白了,你在终端输入 python 之前这样做了吗source activate tensorflow_p36
  • 运行 tmux 可能不会改变你的 python 版本,这与你的虚拟环境有关,它有 python 3.6.4

标签: python ubuntu tensorflow anaconda tmux


【解决方案1】:

总结一下。正如@user2906838 指出的那样,问题在于我在运行 tmux 之前处于 anaconda 虚拟环境中。当我在运行 tmux 之前退出环境并进入 tmux 内部的环境时,一切都照常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-25
    • 1970-01-01
    • 2020-07-09
    • 1970-01-01
    • 1970-01-01
    • 2015-07-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多