简体   繁体   English

模块“dateutil”没有属性“解析器”-Dateutil-Python

[英]Module 'dateutil' has no attribute 'parser' - Dateutil - Python

I am trying to download a pre-trained tensorflow model.我正在尝试下载预训练的 tensorflow 模型。 I am using the below code我正在使用下面的代码

import numpy as np
import time
import PIL.Image
import IPython.display as display
import matplotlib.pylab as plt
import tensorflow as tf
import tensorflow_hub as hub
import datetime
from tensorflow.keras.preprocessing import image
from dateutil import parser

from keras.applications.inception_v3 import InceptionV3
model = InceptionV3()
model.summary()

I am getting the following error我收到以下错误

AttributeError: module 'dateutil' has no attribute 'parser'

I am using python -3.7 and TF-2.7, python-dateutil-2.8.1我正在使用 python -3.7 和 TF-2.7,python-dateutil-2.8.1

Please help me fix this.请帮我解决这个问题。 Thank You :)谢谢你 :)

The correct import syntax is:正确的导入语法是:

import dateutil.parser

and then:进而:

parser.parse(time_string)

or:或者:

from dateutil.parser import parse
parse(time_string)

Documentation: https://dateutil.readthedocs.io/en/stable/parser.html文档: https : //dateutil.readthedocs.io/en/stable/parser.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM