Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
416 views
in Technique[技术] by (71.8m points)

python - Tensorflow-gpu, ModuleNotFoundError: No module named 'dataclasses' in train.py

I am trying to use in windows 10, tensorflow-gpu 2.4.0 to object detection. I don't know how to fix this error, could you please help me?

(tensorflow1) C:ensorflow1models esearchobject_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config 2021-01-06 17:59:49.219069: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll Traceback (most recent call last): File "train.py", line 53, in from object_detection.builders import model_builder File "C:ensorflow1models esearchobject_detectionuildersmodel_builder.py", line 66, in from object_detection.models import ssd_efficientnet_bifpn_feature_extractor as ssd_efficientnet_bifpn File "C:ensorflow1models esearchobject_detectionmodelsssd_efficientnet_bifpn_feature_extractor.py", line 33, in from official.vision.image_classification.efficientnet import efficientnet_model File "C:ensorflow1modelsofficialvisionimage_classificationefficientnetefficientnet_model.py", line 32, in from dataclasses import dataclass ModuleNotFoundError: No module named 'dataclasses'

Thank you in advance!

question from:https://stackoverflow.com/questions/65600280/tensorflow-gpu-modulenotfounderror-no-module-named-dataclasses-in-train-py

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Dataclasses (https://docs.python.org/3/library/dataclasses.html) were introduced in Python 3.7. Based on the error message you posted, I conclude that you are not using a version of Python 3.7 or later. The docs officially state that you need Python 3.5–3.8 (https://www.tensorflow.org/install), so don't use 3.9 which would be the latest version. But actually, the files you are using require dataclasses, and so require 3.7 or higher. I recommend upgrading to Python 3.8 to maximize your compatibility.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...