【昊鼎王五】執行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腳本,看看效果吧,果然沒有報錯了。
好了,聰明如你,就講到這裏吧,有問題的話可以留言。