【昊鼎王五】执行python3脚本,报“ModuleNotFoundError: No module named 'dateutil'”错的解决方法

【昊鼎王五】执行python3脚本,报“ModuleNotFoundError: No module named ‘dateutil’”错的解决方法

报错信息

[root@centos tmp]# python W1.py 
W1.py:4: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  import pymssql
Traceback (most recent call last):
  File "W1.py", line 8, in <module>
    from dateutil import parser
ModuleNotFoundError: No module named 'dateutil'

如下图:
在这里插入图片描述

分析

很明显,是dateutil模块没有找到。所以解决方法就是用pip工具将此模块给安装上。

解决命令

命令如下:

pip3 install dateutil

查看效果,报错
[root@centos tmp]# pip install dateutil
ERROR: Could not find a version that satisfies the requirement dateutil (from versions: none)
ERROR: No matching distribution found for dateutil
在这里插入图片描述
与我们预期结果不符,到底该怎么办呢?

经过查阅资料,发现该模块的全称是:“python-dateutil”
正确的安装该模块的命令如下:

pip3 install python-dateutil

效果如图:
在这里插入图片描述

回到主题

再来执行我们的python脚本,看看效果吧,果然没有报错了。

好了,聪明如你,就讲到这里吧,有问题的话可以留言。
在这里插入图片描述

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值