gpt4 book ai didi

docker - 在带有 gpu 的 docker 中使用 tensorflow

转载 作者:行者123 更新时间:2023-12-02 18:00:26 25 4
gpt4 key购买 nike

我正在尝试按照 docker 中的说明使用 tensorflow

https://www.tensorflow.org/install/docker

我在 centos 7.7.1908 机器上安装了 docker 19.03,我可以运行 nvidia-smi

docker run --gpus all nvidia/cuda:10.1-base nvidia-smi

我的理解是不推荐使用 nvidia-docker。然后我下载tensorflow
docker pull tensorflow/tensorflow:latest-devel-py3

或者
docker pull tensorflow/tensorflow:devel-gpu

但是当我运行其中之一时
docker run -it --rm tensorflow/tensorflow:latest-devel-py3 python -c "import tensorflow as tf;"

我得到

Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'tensorflow' failed to resize tty, using default size



我错过了什么?

好吧,我后来发现
latest-gpu-py3

允许我导入 tensorflow,而
latest-devel-py3

没有。我原以为所有这些图像都会起作用...

最佳答案

“开发”图像包含 tensorflow 源,请参阅:https://hub.docker.com/r/tensorflow/tensorflow/

引用:

devel images come with Bazel and are ideal for developing changes to TensorFlow at master. /tensorflow_src includes the TensorFlow source tree at the latest nightly commit where the Pip package built successfully in the container. We no longer provide images for developing on top of older versions of TF (1.12.0 was the last release where this was the case).

关于docker - 在带有 gpu 的 docker 中使用 tensorflow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58137816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com