【问题标题】:Using Docker for Image training in Python (New to this)在 Python 中使用 Docker 进行图像训练(新功能)
【发布时间】:2017-10-16 07:41:44
【问题描述】:

到目前为止,我的所有步骤都运行良好。我目前在一台 Windows 机器上。使用命令后我在根目录下:

docker run -it gcr.io/tensorflow/tensorflow:latest-devel

然后是 cd /tensorflow,我现在在目录中,是时候训练图像了,所以我想:

/tensorflow# python tensorflow/examples/image_retraining/retrain.py \

--bottleneck_dir=/tf_files/bottlenets \ --how_many_training_steps 500 \ --model_dir=/tf_files/retrained_graph.pb \ --output_labels=/tf_files/retrained_labels.txt \ --image_dir /tf_files/

我得到这个错误: 文件“tensorflow/examples/image_retraining/retrain.py”,第 77 行,在 将 numpy 导入为 np ImportError:没有名为“numpy”的模块

我的 python35 文件夹中已经安装了 numpy,它是最新的。非常感谢您的帮助,我真的很困惑!

【问题讨论】:

  • 在您的 docker 容器中,您可以看到当您执行 pip install numpy --ignore-installed 时会发生什么,然后再试一次。自从我在 docker 上运行这个示例以来已经有一段时间了,我不记得有任何问题。

标签: windows python-3.x docker tensorflow


【解决方案1】:

如果您打算使用 Python 3,我建议您使用 docker run -it gcr.io/tensorflow/tensorflow:latest-devel-py3(在该容器中为 python3 安装了 Numpy)。不知道为什么 Python 3 部分安装在 latest-devel 包中。

【讨论】:

    【解决方案2】:

    从环境变量中删除 python 2.7 并卸载它。之后安装 python 3 并运行以下代码以检查 numPy 是否已正确安装(这将是因为它包含在 python 3 包中,但只是为了重新检查):-

    import numpy as np 
    a = 'hello world' 
    print a
    

    和 numPy 应该可以工作。通过

    再次链接文件夹
    docker run -it -v (folder path)  gcr.io/tensorflow/tensorflow:latest-devel
    

    之后运行

    docker run -it gcr.io/tensorflow/tensorflow:latest-devel
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-29
      • 1970-01-01
      • 2017-11-26
      • 1970-01-01
      • 2021-11-19
      • 2017-07-18
      • 2017-12-13
      • 1970-01-01
      相关资源
      最近更新 更多