我尝试在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:workpose estimationtf-pose-estimationtf_pose__init__.py", line 5, in <module>
from tf_pose.runner import infer, Estimator, get_estimator
File "D:workpose estimationtf-pose-estimationtf_poserunner.py", line 8, in <module>
from tf_pose import eval
File "D:workpose estimationtf-pose-estimationtf_poseeval.py", line 13, in <module>
from tf_pose.estimator import TfPoseEstimator
File "D:workpose estimationtf-pose-estimationtf_poseestimator.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==...
但显示相同的错误
尝试替换以下
import tensorflow.contrib.tensorrt as trt
(用于≤TensorFlow 1.13.1(
带有
from tensorflow.python.compiler.tensorrt import trt
(TensorFlow≥1.14.1(
信用到GitHub