【问题标题】:Tensorflow > ModuleNotFoundError: No module named 'tensorflow.contrib'Tensorflow > ModuleNotFoundError:没有名为“tensorflow.contrib”的模块
【发布时间】:2019-08-06 12:28:54
【问题描述】:

花了几天时间进行故障排除。这是我正在学习的课程的完整安装指南

https://github.com/reigngt09/Pose-Estimation/tree/master/1.%20Pose%20Estimation%20Installation%20Guide

当我尝试在 cmd 中输入以下内容时

$python run_webcam.py --camera video.mp4

我收到以下错误

ModuleNotFoundError: No module named 'tensorflow.contrib'

违规行是

import tensorflow.contrib.tensorrt as trt

这是我的设置规范

Windows 10

Python 3.6.8

CUDA 10.0

cuDNN v 7.6.2

张量流(GPU)1.14.0

GeForce GTX 960M

驱动程序版本 431.60

英特尔酷睿 i7-6700HQ 2.6 GHz*

感谢任何反馈或故障排除步骤!

【问题讨论】:

    标签: python tensorflow


    【解决方案1】:

    您可以尝试通过以下方式导入:

    from tensorflow.python.compiler.tensorrt import trt_convert as trt
    

    https://docs.nvidia.com/deeplearning/frameworks/tf-trt-user-guide/index.html#usage-example

    【讨论】:

    • 谢谢。实际上已经尝试过了,但随后又收到另一个错误“ModuleNotFoundError: No module named 'tensorflow.python.compiler.tensorrt”
    • tensorflow 是否安装正确?当我做一个 $pip list 我得到 tensorflow 1.14.0, tensorflow-estimator 1.14.0, tensorflow-gpu 2.0.0b1
    • 如果我使用 Python 3.7.3 “没有名为 'tensorflow.python.compiler 的模块”而不是 cmd 而不是 cmd 运行,则会得到几乎相同的错误。
    • 确认 import tensorflow 确实可以在 Python shell 中工作。
    • 所以底线是缺少 tensorRT 模块。那怎么安装呢?快速谷歌显示没有 Windows 安装程序或支持?我已经尝试卸载然后重新安装 tensorflow 和 tensorflow-gpu
    猜你喜欢
    • 1970-01-01
    • 2020-07-07
    • 1970-01-01
    • 2022-06-28
    • 1970-01-01
    • 2020-02-23
    • 1970-01-01
    • 2020-07-13
    相关资源
    最近更新 更多