我尝试在CMD上运行python。 我在我的python文件中导入tensorflow.contrib。
import tensorflow.contrib.tensorrt as trt
使用此命令在anaconda上运行时。
python run_webcam.py --camera yoga.mp4
显示错误:
File "run_webcam.py", line 8, in <module>
from tf_pose.estimator import TfPoseEstimator
File "D:\work\pose estimation\tf-pose-estimation\tf_pose\__init__.py", line 5, in <module>
from tf_pose.runner import infer, Estimator, get_estimator
File "D:\work\pose estimation\tf-pose-estimation\tf_pose\runner.py", line 8, in <module>
from tf_pose import eval
File "D:\work\pose estimation\tf-pose-estimation\tf_pose\eval.py", line 13, in <module>
from tf_pose.estimator import TfPoseEstimator
File "D:\work\pose estimation\tf-pose-estimation\tf_pose\estimator.py", line 14, in <module>
import tensorflow.contrib.tensorrt as trt
ModuleNotFoundError: No module named 'tensorflow.contrib'
我已安装
pip install tensorflow
并更改tensorflow的版本(尝试卸载并安装许多版本)
pip uninstall tensorflow
pip install tensorflow==...
但显示相同的错误
答案 0 :(得分:0)
尝试替换以下内容
import tensorflow.contrib.tensorrt as trt
(用于≤TensorFlow 1.13.1)
使用
from tensorflow.python.compiler.tensorrt import trt
(TensorFlow≥1.14.1)
贷记GitHub